Options
All
  • Public
  • Public/Protected
  • All
Menu

Class IPv4CidrRange

Represents a continuous segment of IPv4 numbers following the classless inter-domain routing scheme for allocating IP addresses.

see

https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing

Hierarchy

Implements

Index

Constructors

constructor

  • Constructor for creating an instance of an IPv4 range.

    The arguments taken by the constructor is inspired by the CIDR notation which basically consists of the IP number and the prefix.

    Parameters

    • ipv4: IPv4

      the IP number used to construct the range. By convention this is the first IP number in the range, but it could also be any IP number within the range

    • cidrPrefix: IPv4Prefix

      the prefix which is a representation of the number of bits used to mask the given IP number in other to create the range

    Returns IPv4CidrRange

Properties

bitValue

bitValue: BigInteger = bigInt(32)

cidrPrefix

cidrPrefix: IPv4Prefix

the prefix which is a representation of the number of bits used to mask the given IP number in other to create the range

Private internalCounterValue

internalCounterValue: IPv4

Private ipv4

ipv4: IPv4

the IP number used to construct the range. By convention this is the first IP number in the range, but it could also be any IP number within the range

Methods

__@iterator

  • __@iterator(): IterableIterator<IPv4>

contains

  • Indicates if the given IPv4 range is a subset.

    By a subset range, it means all the values of the given range are contained by this IPv4 range

    Parameters

    Returns boolean

    true if the other Ipv4 range is a subset. False otherwise.

getFirst

getLast

getSize

  • getSize(): BigInteger

hasNextRange

  • hasNextRange(): boolean

hasPreviousRange

  • hasPreviousRange(): boolean

inside

  • Indicate if the given range is a container range.

    By container range, it means all the IP number in this current range can be found within the given range.

    Parameters

    Returns boolean

    true if the other Ipv4 range is a container range. False otherwise.

isConsecutive

  • Indicates whether the given IPv4 range is an adjacent range.

    An adjacent range being one where the end of the given range, when incremented by one marks the start of the other range. Or where the start of the given range, when decreased by one, marks the end of the other range

    Parameters

    Returns boolean

    true if the two IPv4 ranges are consecutive, false otherwise

isOverlapping

next

  • next(value?: any): IteratorResult<IPv4>
  • next(value?: any): IteratorResult<IPv4>

nextRange

previousRange

split

take

  • take(count: number): Array<IPv4>
  • Method that takes IPv4 number from within an IPv4 range, starting from the first IPv4 number

    Parameters

    • count: number

      the amount of IPv4 number to take from the IPv4 range

    Returns Array<IPv4>

    an array of IPv4 number, taken from the IPv4 range

toCidrString

  • toCidrString(): string

toRangeString

  • toRangeString(): string
  • Method that returns the IPv4 range in string notation where the first IPv4 number and last IPv4 number are separated by an hyphen. eg. 192.198.0.0-192.198.0.255

    Returns string

    the range in [first IPv4 number] - [last IPv4 number] format

Static fromCidr

  • Convenience method for constructing an instance of an IPv4CidrRange from an IP range represented in CIDR notation

    Parameters

    • rangeIncidrNotation: string

      the range of the IPv4 number in CIDR notation

    Returns IPv4CidrRange

    the IPv4CidrRange

Generated using TypeDoc