class Subnet::IPv6::Unspecified
- Subnet::IPv6::Unspecified
- Subnet::IPv6
- Reference
- Object
Overview
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:
0000:0000:0000:0000:0000:0000:0000:0000
but, with the use of compression, it is usually written as just two colons:
::
or, specifying the netmask:
::/128
With Subnet, create a new unspecified IPv6 address using its own subclass:
ip = Subnet::IPv6::Unspecified.new
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 = Subnet.parse "::"
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.
Defined in:
subnet/ipv6.crConstructors
-
.new(bla = nil)
Creates a new IPv6 unspecified address
Instance methods inherited from class Subnet::IPv6
<=>(oth)
<=>,
[](index)
[],
[]=(index, value)
[]=,
address : String
address,
allocate(skip = 0)
allocate,
arpa
arpa,
bits
bits,
broadcast_u128
broadcast_u128,
compressed : String
compressed,
data
data,
each(&)
each,
group(index)
group,
groups : Array(Int32)
groups,
hex_groups
hex_groups,
hexstring
hexstring,
includes?(oth)
includes?,
link_local?
link_local?,
literal
literal,
loopback?
loopback?,
mapped?
mapped?,
network
network,
network?
network?,
network_u128
network_u128,
pred
pred,
prefix : Prefix128
prefix,
prefix=(num)
prefix=,
reverse
reverse,
size
size,
succ
succ,
to_big_i
to_big_i,
to_i
to_i,
to_json(json : JSON::Builder)
to_json,
to_s : String
to_s,
to_string
to_string,
to_string_uncompressed
to_string_uncompressed,
to_u128
to_u128,
unique_local?
unique_local?,
unspecified?
unspecified?
Constructor methods inherited from class Subnet::IPv6
new(str : String)new(value : JSON::PullParser) : Subnet::IPv6 new
Class methods inherited from class Subnet::IPv6
compress(str)
compress,
expand(str)
expand,
groups(str)
groups,
parse_data(data, prefix = 128)
parse_data,
parse_hex(hexstring, prefix = 128)
parse_hex,
parse_u128(u128, prefix = 128)
parse_u128
Instance methods inherited from module Subnet
ipv4?
ipv4?,
ipv6?
ipv6?,
to_json(json : JSON::Builder)
to_json
Constructor methods inherited from module Subnet
new(value : JSON::PullParser) : Subnet
new,
parse(str) : Subnet
parse
Class methods inherited from module Subnet
deprecate(message = nil)
deprecate,
ntoa(uint)
ntoa,
valid?(addr)
valid?,
valid_ip?(addr)
valid_ip?,
valid_ipv4?(addr)
valid_ipv4?,
valid_ipv4_netmask?(addr)
valid_ipv4_netmask?,
valid_ipv4_subnet?(addr)
valid_ipv4_subnet?,
valid_ipv6?(addr)
valid_ipv6?,
valid_ipv6_subnet?(addr)
valid_ipv6_subnet?
Constructor Detail
Creates a new IPv6 unspecified address
ip = Subnet::IPv6::Loopback.new
ip.to_string
# => "::1/128"