Sha256: a9cbf28bfe29e9847a8ec6e30e6772fc090b4c7aa45387c96e140ae7d6601478

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require_relative '../ipaddress'
require_relative 'ipv6'

require_relative 'crunchy'

class IPAddress
  class Ipv6Loopback
    #    The loopback  address is a unicast localhost address. If an
    #  application in a host sends packets to this address, the IPv6 stack
    #  will loop these packets back on the same virtual interface.
    #
    #  Loopback addresses are expressed in the following form:
    #
    #    ::1
    #
    #  or, with their appropriate prefix,
    #
    #    ::1/128
    #
    #  As for the unspecified addresses, IPv6 loopbacks can be created with
    #  IPAddress calling their own class:
    #
    #    ip = IPAddress::IPv6::Loopback.new
    #
    #    ip.to_string
    #      # => "::1/128"
    #
    #  or by using the wrapper:
    #
    #    ip = IPAddress "::1"
    #
    #    ip.to_string
    #      # => "::1/128"
    #
    #  Checking if an address is loopback is easy with the IPv6# loopback?
    #  method:
    #
    #    ip.loopback?
    #      # => true
    #
    #  The IPv6 loopback address corresponds to 127.0.0.1 in IPv4.
    #
    #
    #  Creates a new IPv6 unspecified address
    #
    #    ip = IPAddress::IPv6::Loopback.new
    #
    #    ip.to_string
    #      # => "::1/128"
    #
    def self.create()
      return Ipv6.from_number(Crunchy.one(), 128);
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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