Skip to content

Commit

Permalink
webrtc: add webrtc addresses to host normalizer (#2784)
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt committed May 8, 2024
1 parent af0161e commit 01ce97c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion p2p/host/basic/basic_host.go
Expand Up @@ -811,7 +811,11 @@ 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 {
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)
Expand Down

0 comments on commit 01ce97c

Please sign in to comment.