-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
move ResolveUnspecifiedAddress(es) and FilterAddrs here from libp2p/go-addr-util #168
Conversation
cb0380f
to
c4491e3
Compare
c4491e3
to
ae82086
Compare
ae82086
to
135ab44
Compare
135ab44
to
6792670
Compare
net/ip.go
Outdated
@@ -95,6 +95,18 @@ func IsIPUnspecified(m ma.Multiaddr) bool { | |||
return net.IP(c.RawValue()).IsUnspecified() | |||
} | |||
|
|||
// AddrOverNonLocalIP returns whether the addr uses a non-local ip link | |||
func AddrOverNonLocalIP(a ma.Multiaddr) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a strange function. What about IPv4 localhost?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where we use it: https://github.com/libp2p/go-libp2p-swarm/blob/69f15a70a0caa2ad4f94bfc603f63181b13a40fb/swarm_dial.go#L636-L661
Is there any reason we don't want to dial IPv6 link-local addresses, but are ok with dialing IPv4 localhost?
At least the code here is consistent with the comment in the swarm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason we don't want to dial IPv6 link-local addresses, but are ok with dialing IPv4 localhost?
Because they're almost always useless while localhost can actually be useful (and is usually only one address). NOTE: I don't think we advertise link-local addresses anymore.
Really, this isn't the right place to do things like this, but it's the only place till we get a real address "scope" system.
At least the code here is consistent with the comment in the swarm.
I'd change it to IsIpv6LinkLocal
, or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I renamed the function. All (the few) users of that functions will need to adjust the path manually anyway, so this doesn't create too much extra hassle.
These are the only functions in use from libp2p/go-addr-util. By moving them here, we can deprecate that package.