when we do a nat port mapping, explicitly remember the mapped address
related to
I won't call this *fixed* yet but it should help.
@@ -8,6 +8,7 @@ import (
lgbl "github.com/libp2p/go-libp2p-loggables"
inat "github.com/libp2p/go-libp2p-nat"
inet "github.com/libp2p/go-libp2p-net"
+ pstore "github.com/libp2p/go-libp2p-peerstore"
ma "github.com/multiformats/go-multiaddr"
)
@@ -187,6 +188,9 @@ func addPortMapping(nmgr *natManager, intaddr ma.Multiaddr) {
return
}
+ // TODO: make these temporary and rediscover them.
+ nmgr.net.Peerstore().AddAddr(nmgr.net.LocalPeer(), extaddr, pstore.PermanentAddrTTL)
+
lm["outcome"] = "success"
lm["externalAddr"] = func() interface{} { return extaddr.String() }
log.Infof("established nat port mapping: %s <--> %s", intaddr, extaddr)
