mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-09-26 20:21:26 +08:00
basichost: add certhashes to addrs in place (#3200)
This commit is contained in:
@@ -1004,6 +1004,7 @@ func (h *BasicHost) AllAddrs() []ma.Multiaddr {
|
||||
return finalAddrs
|
||||
}
|
||||
|
||||
// addCertHashes adds certhashes to the relevant addresses. It modifies `addrs` in place.
|
||||
func (h *BasicHost) addCertHashes(addrs []ma.Multiaddr) []ma.Multiaddr {
|
||||
// This is a temporary workaround/hack that fixes #2233. Once we have a
|
||||
// proper address pipeline, rework this. See the issue for more context.
|
||||
@@ -1020,11 +1021,6 @@ func (h *BasicHost) addCertHashes(addrs []ma.Multiaddr) []ma.Multiaddr {
|
||||
return addrs
|
||||
}
|
||||
|
||||
// Copy addrs slice since we'll be modifying it.
|
||||
addrsOld := addrs
|
||||
addrs = make([]ma.Multiaddr, len(addrsOld))
|
||||
copy(addrs, addrsOld)
|
||||
|
||||
for i, addr := range addrs {
|
||||
wtOK, wtN := libp2pwebtransport.IsWebtransportMultiaddr(addr)
|
||||
webrtcOK, webrtcN := libp2pwebrtc.IsWebRTCDirectMultiaddr(addr)
|
||||
|
Reference in New Issue
Block a user