summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ipaddress/ipv6.rb14
1 files changed, 14 insertions, 0 deletions
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
#