sukun
6 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
5 additions and
1 deletions
-
p2p/host/basic/basic_host.go
|
@ -811,7 +811,11 @@ func (h *BasicHost) Addrs() []ma.Multiaddr { |
|
|
// NormalizeMultiaddr returns a multiaddr suitable for equality checks.
|
|
|
// NormalizeMultiaddr returns a multiaddr suitable for equality checks.
|
|
|
// If the multiaddr is a webtransport component, it removes the certhashes.
|
|
|
// If the multiaddr is a webtransport component, it removes the certhashes.
|
|
|
func (h *BasicHost) NormalizeMultiaddr(addr ma.Multiaddr) ma.Multiaddr { |
|
|
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 |
|
|
out := addr |
|
|
for i := 0; i < n; i++ { |
|
|
for i := 0; i < n; i++ { |
|
|
out, _ = ma.SplitLast(out) |
|
|
out, _ = ma.SplitLast(out) |
|
|