Commit 7133f412 authored by Steven Allen's avatar Steven Allen
Browse files

when we do a nat port mapping, explicitly remember the mapped address

related to #383

I won't call this *fixed* yet but it should help.
Showing with 4 additions and 0 deletions
+4 -0
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment