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
fdfa2246
Commit
fdfa2246
authored
Oct 24, 2018
by
vyzo
Browse files
document doUpdateAddrs
parent
4be7ada3
Changes
1
Hide whitespace changes
Inline
Side-by-side
p2p/host/relay/autorelay.go
View file @
fdfa2246
...
@@ -184,6 +184,15 @@ func (h *AutoRelayHost) updateAddrs() {
...
@@ -184,6 +184,15 @@ func (h *AutoRelayHost) updateAddrs() {
h
.
PushIdentify
()
h
.
PushIdentify
()
}
}
// This function updates our NATed advertised addrs (h.addrs)
// The public addrs are rewritten so that they only retain the public IP part; they
// become undialable but are useful as a hint to the dialer to determine whether or not
// to dial private addrs.
// The non-public addrs are included verbatim so that peers behind the same NAT/firewall
// can still dial us directly.
// On top of those, we add the relay-specific addrs for the relays to which we are
// connected. For each non-private relay addr, we encapsulate the p2p-circuit addr
// through which we can be dialed.
func
(
h
*
AutoRelayHost
)
doUpdateAddrs
()
{
func
(
h
*
AutoRelayHost
)
doUpdateAddrs
()
{
h
.
mx
.
Lock
()
h
.
mx
.
Lock
()
defer
h
.
mx
.
Unlock
()
defer
h
.
mx
.
Unlock
()
...
...
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