From 548f00716f483876d00532bf76deec6c4171e9d6 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Mon, 14 Nov 2016 14:33:13 -0700 Subject: Implement unique_local? method --- lib/ipaddress/ipv6.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/ipaddress/ipv6.rb b/lib/ipaddress/ipv6.rb index 6850c03..1012d7d 100644 --- a/lib/ipaddress/ipv6.rb +++ b/lib/ipaddress/ipv6.rb @@ -436,6 +436,20 @@ module IPAddress; [self.class.new("fe80::/64")].any? {|i| i.include? self} end + # + # Checks if an IPv6 address objects belongs + # to a unique-local network RFC4193 + # + # Example: + # + # ip = IPAddress "fc00::1" + # ip.unique_local? + # #=> true + # + def unique_local? + [self.class.new("fc00::/7")].any? {|i| i.include? self} + end + # # Returns true if the address is a mapped address # -- cgit v1.2.1