Sha256: a6a300bcf266efd1f13df714716d2f5cde59d6cc81da96b3b3d7be800e94bd89

Contents?: true

Size: 1.57 KB

Versions: 1

Compression:

Stored size: 1.57 KB

Contents

require_relative '../ipaddress'

class IPAddress
  class Ipv6Unspec
    #  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 IPAddress, create a new unspecified IPv6 address using its own
    #  subclass:
    #
    #    ip = IPAddress::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 = IPAddress "::"
    #
    #    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.
    #
    #
    #  Creates a new IPv6 unspecified address
    #
    #    ip = IPAddress::IPv6::Unspecified.new
    #
    #    ip.to_s
    #       # => => "::/128"
    #
    def self.create()
      return Ipv6.from_number(Crunchy.zero, 128)
    end

    #  class IPv6::Unspecified
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
construqt-ipaddress-2.0.1 lib/ipaddress/ipv6_unspec.rb