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
5d72a118
Commit
5d72a118
authored
Nov 15, 2018
by
Can ZHANG
Browse files
Remember observed addresses for wildcard local addresses as well
parent
69ff94d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
p2p/protocol/identify/id.go
View file @
5d72a118
...
...
@@ -412,6 +412,18 @@ func (ids *IDService) consumeObservedAddress(observed []byte, c inet.Conn) {
}
func
addrInAddrs
(
a
ma
.
Multiaddr
,
as
[]
ma
.
Multiaddr
)
bool
{
// allow wildcard addresses
if
ip
,
err
:=
a
.
ValueForProtocol
(
ma
.
P_IP4
);
err
==
nil
{
if
parsed
:=
net
.
ParseIP
(
ip
);
parsed
!=
nil
&&
parsed
.
IsUnspecified
()
{
return
true
}
}
if
ip
,
err
:=
a
.
ValueForProtocol
(
ma
.
P_IP6
);
err
==
nil
{
if
parsed
:=
net
.
ParseIP
(
ip
);
parsed
!=
nil
&&
parsed
.
IsUnspecified
()
{
return
true
}
}
for
_
,
b
:=
range
as
{
if
a
.
Equal
(
b
)
{
return
true
...
...
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