mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-08 16:03:06 +00:00
Merge pull request #2 from whyrusleeping/master
add function to test for link local ipv6 addrs
This commit is contained in:
commit
30d77c8222
6
ip.go
6
ip.go
@ -69,6 +69,12 @@ func IsIPLoopback(m ma.Multiaddr) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IPV6 Link Local addresses are non routable.
|
||||||
|
func IsIPV6LinkLocal(m ma.Multiaddr) bool {
|
||||||
|
b := m.Bytes()
|
||||||
|
return bytes.HasPrefix(b, []byte{41, 254, 128})
|
||||||
|
}
|
||||||
|
|
||||||
// IsIPUnspecified returns whether a Multiaddr is am Unspecified IP address
|
// IsIPUnspecified returns whether a Multiaddr is am Unspecified IP address
|
||||||
// This means either /ip4/0.0.0.0 or /ip6/::
|
// This means either /ip4/0.0.0.0 or /ip6/::
|
||||||
func IsIPUnspecified(m ma.Multiaddr) bool {
|
func IsIPUnspecified(m ma.Multiaddr) bool {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user