mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-09-26 20:21:26 +08:00
basichost: avoid modifying slice returned by AddrsFactory (#3068)
This commit is contained in:
@@ -582,7 +582,7 @@ func (cfg *Config) addAutoNAT(h *bhost.BasicHost) error {
|
||||
if cfg.AddrsFactory != nil {
|
||||
addrFunc = func() []ma.Multiaddr {
|
||||
return slices.DeleteFunc(
|
||||
cfg.AddrsFactory(h.AllAddrs()),
|
||||
slices.Clone(cfg.AddrsFactory(h.AllAddrs())),
|
||||
func(a ma.Multiaddr) bool { return !manet.IsPublicAddr(a) })
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user