From cd2fd6035863db69863319a7db1427dbe583245a Mon Sep 17 00:00:00 2001 From: sukun Date: Sun, 5 May 2024 20:36:27 +0530 Subject: [PATCH] webrtc: add webrtc addresses to host normalizer --- p2p/host/basic/basic_host.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/p2p/host/basic/basic_host.go b/p2p/host/basic/basic_host.go index 367fca05f2..c2d70f0bb3 100644 --- a/p2p/host/basic/basic_host.go +++ b/p2p/host/basic/basic_host.go @@ -809,7 +809,12 @@ func (h *BasicHost) Addrs() []ma.Multiaddr { // NormalizeMultiaddr returns a multiaddr suitable for equality checks. // If the multiaddr is a webtransport component, it removes the certhashes. func (h *BasicHost) NormalizeMultiaddr(addr ma.Multiaddr) ma.Multiaddr { - if ok, n := libp2pwebtransport.IsWebtransportMultiaddr(addr); ok && n > 0 { + var n int + ok, n := libp2pwebtransport.IsWebtransportMultiaddr(addr) + if !ok { + ok, n = libp2pwebrtc.IsWebRTCDirectMultiaddr(addr) + } + if ok && n > 0 { out := addr for i := 0; i < n; i++ { out, _ = ma.SplitLast(out)