Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
7133f412
Commit
7133f412
authored
Aug 02, 2018
by
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.
parent
d9712a3b
Changes
1
Show whitespace changes
Inline
Side-by-side
p2p/host/basic/natmgr.go
View file @
7133f412
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment