- Defined in:
The address with all zero bits is called the unspecified address (corresponding to 0.0.0.0 in IPv4). It should be something like this:
but, with the use of compression, it is usually written as just two colons:
or, specifying the netmask:
With IPAddress, create a new unspecified IPv6 address using its own subclass:
ip = ::::Unspecified. ip.to_s #=> => "::/128"
You can easily check if an IPv6 object is an unspecified address by using the IPv6#unspecified? method
ip.unspecified? #=> true
An unspecified IPv6 address can also be created with the wrapper method, like we've seen before
ip = "::" ip.unspecified? #=> true
This address must never be assigned to an interface and is to be used only in software before the application has learned its host's source address appropriate for a pending connection. Routers must not forward packets with the unspecified address.
Constants inherited from
Constants included from
Instance Method Summary collapse
#initialize ⇒ Unspecified
Creates a new IPv6 unspecified address.
Methods inherited from
, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Methods included from
, , , , , , , , , , ,
Creates a new IPv6 unspecified address
ip = ::::.new ip.to_s #=> => "::/128"
692 693 694 695 696 697
# File 'lib/ipaddress/ipv6.rb', line 692 def initialize @address = ("0000:"*8).chop @groups = Array.new(8,0) @prefix = .(128) @compressed = compress_address end