mirror of
https://github.com/logos-messaging/go-multiaddr.git
synced 2026-01-02 13:03:11 +00:00
fixed link local check
This commit is contained in:
parent
8359bd0b54
commit
2bb75c7221
4
ip.go
4
ip.go
@ -70,11 +70,11 @@ func IsIPLoopback(m ma.Multiaddr) bool {
|
||||
}
|
||||
|
||||
// IP6 Link Local addresses are non routable. The prefix is technically
|
||||
// fe80::/10, but we test fe80::/12 for simplicity (no need to mask).
|
||||
// fe80::/10, but we test fe80::/16 for simplicity (no need to mask).
|
||||
// So far, no hardware interfaces exist long enough to use those 2 bits.
|
||||
// Send a PR if there is.
|
||||
func IsIP6LinkLocal(m ma.Multiaddr) bool {
|
||||
return bytes.HasPrefix(m.Bytes(), []byte{ma.P_IP6, 0xfe, 0x80, 0})
|
||||
return bytes.HasPrefix(m.Bytes(), []byte{ma.P_IP6, 0xfe, 0x80})
|
||||
}
|
||||
|
||||
// IsIPUnspecified returns whether a Multiaddr is am Unspecified IP address
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user