Skip to content

Commit

Permalink
webrtc: add webrtc addresses to host normalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt committed May 5, 2024
1 parent 0385ec9 commit cd2fd60
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion p2p/host/basic/basic_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cd2fd60

Please sign in to comment.