From e97d6f0566af4eb3535df811b3ae2663925fc0ee Mon Sep 17 00:00:00 2001 From: Jeromy Date: Sun, 11 Jan 2015 18:26:49 +0000 Subject: [PATCH] add function to test for link local ipv6 addrs --- ip.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ip.go b/ip.go index 2e6389b..d0e2696 100644 --- a/ip.go +++ b/ip.go @@ -69,6 +69,12 @@ func IsIPLoopback(m ma.Multiaddr) bool { 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 // This means either /ip4/0.0.0.0 or /ip6/:: func IsIPUnspecified(m ma.Multiaddr) bool {