ip-num
    Preparing search index...

    Class IPv4

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

    Hierarchy (View Summary)

    Index

    Constructors

    • Constructor for an IPv4 number.

      Parameters

      • ipValue: string | number | bigint

        value to construct an IPv4 from. The given value can either be numeric or string. If a string is given then it needs to be in dot-decimal notation

      Returns IPv4

    Properties

    bitSize: number = 32

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

    maximumBitSize: bigint = Validator.THIRTY_TWO_BIT_SIZE

    The maximum bit size (i.e. binary value) of the IPv4 number in BigInt

    octets: Octet[] = []

    An array of Octet's

    separator: string = "."

    The string character used to separate the individual octets when the IPv4 is rendered as strings

    type: IPNumType = IPNumType.IPv4

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

    value: bigint

    The decimal value represented by the IPv4 number in BigInt

    Methods

    • Gets the numeric value of an IP number as BigInt

      Returns bigint

      bigInt the numeric value of an IP number.

    • 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.

    • 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.

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

      Parameters

      Returns boolean

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

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

      Parameters

      Returns boolean

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

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

      Parameters

      Returns boolean

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

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

      Parameters

      Returns boolean

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

    • Returns this IPv4 number as a IPv4-Mapped IPv6 Address

      The IPv4-Mapped IPv6 Address allows an IPv4 number to be embedded within an IPv6 number

      {@see https://tools.ietf.org/html/rfc4291#section-2.5.5} for more information on the IPv4-Mapped IPv6 Address

      Returns IPv6

      an IPv6 number with the IPv4 embedded within it

    • A string representation of the IPv4 number. The string representation is in dot-decimal notation

      Returns string

      The string representation in dot-decimal notation

    • A convenience method for creating an IPv4 from binary string

      Parameters

      • ipBinaryString: string

        the binary string representing the IPv4 number to be created

      Returns IPv4

      the IPv4 instance

    • A convenience method for creating an IPv4 by providing the decimal value of the IP number in BigInt

      Parameters

      • bigIntValue: number | bigint

        the decimal value of the IP number in BigInt

      Returns IPv4

      the IPv4 instance

    • Alias for IPv4.fromDecimalDottedString.

      Parameters

      • ipString: string

        the IP number in dot-decimal notation

      Returns IPv4

      the IPv4 instance