struct

Ipconv::IPv6

Inherits Comparable < Struct < Value < Object

Constants

SPECIAL_RANGES = [{->(hi : UInt64, lo : UInt64) do (hi == 0) && (lo == 0) end, Special::Unspecified}, {->(hi : UInt64, lo : UInt64) do (hi == 0) && (lo == 1) end, Special::Loopback}, {->(hi : UInt64, lo : UInt64) do (hi == 0) && ((lo >> 32) == 65535) end, Special::IPv4Mapped}, {->(hi : UInt64, lo : UInt64) do (hi == 0) && ((lo >> 32) == 0) end, Special::IPv4Compatible}, {->(hi : UInt64, _lo : UInt64) do hi == 72057594037927936_u64 end, Special::Discard}, {->(hi : UInt64, _lo : UInt64) do (hi >> 32) == 536939960_u64 end, Special::Documentation}, {->(hi : UInt64, _lo : UInt64) do (hi & 18446744073709486080_u64) == 2306124492780339200_u64 end, Special::Benchmarking}, {->(hi : UInt64, _lo : UInt64) do (hi >> 36) == 33558530_u64 end, Special::Orchid}, {->(hi : UInt64, _lo : UInt64) do (hi >> 32) == 536936448_u64 end, Special::Teredo}, {->(hi : UInt64, _lo : UInt64) do (hi >> 48) == 8194_u64 end, Special::SixToFour}, {->(hi : UInt64, _lo : UInt64) do (hi >> 61) == 1_u64 end, Special::GlobalUnicast}, {->(hi : UInt64, _lo : UInt64) do (hi >> 57) == 126_u64 end, Special::UniqueLocal}, {->(hi : UInt64, _lo : UInt64) do (hi >> 54) == 1018_u64 end, Special::LinkLocal}, {->(hi : UInt64, _lo : UInt64) do (hi >> 56) == 255_u64 end, Special::Multicast}]

Constructors

new(hi : UInt64, lo : UInt64)
Source
new(groups : StaticArray(UInt16, 8))
Source
parse(input : String) : IPv6
Source

Instance methods

-(other : IPv6) : UInt128
Source
<=>(other : IPv6) : Int32

The comparison operator. Returns 0 if the two objects are equal, a negative number if this object is considered less than other, a positive number if this object is considered greater than other, or nil if the two objects are not comparable.

Subclasses define this method to provide class-specific ordering.

The comparison operator is usually used to sort values:

# Sort in a descending way:
[3, 1, 2].sort { |x, y| y <=> x } # => [3, 2, 1]

# Sort in an ascending way:
[3, 1, 2].sort { |x, y| x <=> y } # => [1, 2, 3]
Source
[](index : Int) : UInt16
Source
groups
Source
mapped_ipv4
Source
special
Source
succ
Source
to_compressed
Source
to_expanded
Source
to_mixed
Source
to_s(io : IO) : Nil

Same as #inspect(io).

Source

Nested types