Skip to content

Commit 01ce97c

Browse files
authored
webrtc: add webrtc addresses to host normalizer (#2784)
1 parent af0161e commit 01ce97c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

p2p/host/basic/basic_host.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,11 @@ func (h *BasicHost) Addrs() []ma.Multiaddr {
811811
// NormalizeMultiaddr returns a multiaddr suitable for equality checks.
812812
// If the multiaddr is a webtransport component, it removes the certhashes.
813813
func (h *BasicHost) NormalizeMultiaddr(addr ma.Multiaddr) ma.Multiaddr {
814-
if ok, n := libp2pwebtransport.IsWebtransportMultiaddr(addr); ok && n > 0 {
814+
ok, n := libp2pwebtransport.IsWebtransportMultiaddr(addr)
815+
if !ok {
816+
ok, n = libp2pwebrtc.IsWebRTCDirectMultiaddr(addr)
817+
}
818+
if ok && n > 0 {
815819
out := addr
816820
for i := 0; i < n; i++ {
817821
out, _ = ma.SplitLast(out)

0 commit comments

Comments
 (0)