Options
All
  • Public
  • Public/Protected
  • All
Menu

Class IPv6

Represents an IPv6 number. A 128 bit number that is used to uniquely identify a device that is part of a computer network that uses the internet protocol for communication.

see

https://en.wikipedia.org/wiki/IPv6

see

https://www.rfc-editor.org/info/rfc8200

Hierarchy

Index

Constructors

constructor

  • new IPv6(ipValue: string | BigInteger): IPv6
  • Constructor for an IPv6 number.

    Parameters

    • ipValue: string | BigInteger

      value to construct an IPv6 from. The given value can either be numeric or string. If a string is given then it needs to be in hexadecatet string notation

    Returns IPv6

Properties

bitSize

bitSize: number = 128

The number of bits needed to represents the value of the IPv6 number

hexadecatet

hexadecatet: Array<Hexadecatet> = []

An array of Hexadecatet's

type

{Array} the hexadecatet that makes up the IPv6 number

maximumBitSize

maximumBitSize: BigInteger = Validator.ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_SIZE

The maximum bit size (i.e. binary value) of the IPv6 number in BigInteger

separator

separator: string = ":"

The string character used to separate the individual hexadecatet when the IPv6 is rendered as strings

type

{string} The string character used to separate the individual hexadecatet when rendered as strings

type

type: IPNumType = IPNumType.IPv6

The type of IP number. Value is one of the values of the IPNumType enum

type

{IPNumType} the type of IP number

value

value: BigInteger

The decimal value represented by the IPv6 number in BigInteger

Methods

Private binaryStringToHexadecatets

  • binaryStringToHexadecatets(binaryString: string): Hexadecatet[]

Private constructFromBigIntegerValue

  • constructFromBigIntegerValue(ipv6Number: BigInteger): [BigInteger, Array<Hexadecatet>]

Private constructFromHexadecimalDottedString

  • constructFromHexadecimalDottedString(expandedIPv6: string): [BigInteger, Array<Hexadecatet>]

getHexadecatet

getValue

  • getValue(): BigInteger
  • Gets the numeric value of an IP number as {@link BigInteger}

    Returns BigInteger

    the numeric value of an IP number.

hasNext

  • hasNext(): boolean
  • Checks if an IP number has a value greater than the present value

    Returns boolean

    true, if there is a value greater than the present value. Returns false otherwise.

hasPrevious

  • hasPrevious(): boolean
  • Checks if an IP number has a value lesser than the present value

    Returns boolean

    true, if there is a value lesser than the present value. Returns false otherwise.

isEquals

  • Checks if the given IP number, is equals to the current IP number

    Parameters

    • anotherIPNum: AbstractIPNum

      the other IP number to compare with

    Returns boolean

    true if the given IP number is equals

isGreaterThan

  • Checks if the given IP number is greater than this current IP number

    Parameters

    • anotherIPNum: AbstractIPNum

      the other IP number to compare with

    Returns boolean

    true if the given IP number is greater than this current one. False otherwise.

isGreaterThanOrEquals

  • Checks if the given IP number is greater than or equals to this current IP number

    Parameters

    • anotherIPNum: AbstractIPNum

      the other IP number to compare with

    Returns boolean

    {boolean} true if the given IP number is greater than or equals to this current one. False otherwise.

isLessThan

  • Checks if the given IP number is lesser than this current IP number

    Parameters

    • anotherIPNum: AbstractIPNum

      the other IP number to compare with

    Returns boolean

    true if the given IP number is less than this current one. False otherwise.

isLessThanOrEquals

  • Checks if the given IP number is less than or equals to this current IP number

    Parameters

    • anotherIPNum: AbstractIPNum

      the other IP number to compare with

    Returns boolean

    true if the given IP number is less than or equals to this current one. False otherwise.

nextIPNumber

  • nextIPNumber(): IPv6

previousIPNumber

  • previousIPNumber(): IPv6

toBinaryString

  • toBinaryString(): string

toString

  • toString(): string
  • A string representation of the IPv6 number.

    Returns string

    The string representation of IPv6

Static fromBigInteger

  • fromBigInteger(bigIntValue: BigInteger): IPv6
  • A convenience method for creating an IPv6 by providing the decimal value of the IP number in BigInteger

    Parameters

    • bigIntValue: BigInteger

      the decimal value of the IP number in BigInteger

    Returns IPv6

    the IPv6 instance

Static fromBinaryString

  • fromBinaryString(ipBinaryString: string): IPv6
  • A convenience method for creating an IPv6 from binary string

    Parameters

    • ipBinaryString: string

      the binary string representing the IPv6 number to be created

    Returns IPv6

    the IPv6 instance

Static fromHexadecimalString

  • fromHexadecimalString(ipString: string): IPv6

Static fromIPv4

  • A convenience method for creating an IPv4-Compatible IPv6 Address from an instance of IPv4

    Parameters

    • ipv4: IPv4

      to create an IPv4-Compatible IPv6 Address

    Returns IPv6

    the IPv4-Compatible IPv6 Address

Static fromIPv4DotDecimalString

  • fromIPv4DotDecimalString(ip4DotDecimalString: string): IPv6
  • A convenience method for creating an IPv4-Compatible IPv6 Address from a IPv4 represented in dot-decimal notation i.e. 127.0.0.1

    Parameters

    • ip4DotDecimalString: string

      string represented in a dot decimal string

    Returns IPv6

    the IPv4-Compatible IPv6 Address

Static fromString

  • fromString(ipString: string): IPv6
  • Alias for IPv6.fromHexadecimalString

    Parameters

    • ipString: string

      the IP number in hexadecatet

    Returns IPv6

    the IPv6 instance

Generated using TypeDoc