Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CIDRBlock

Hierarchy

  • CIDRBlock

Index

Constructors

Protected constructor

  • new CIDRBlock(networkAddr: number, prefix: number): CIDRBlock
  • Parameters

    • networkAddr: number
    • prefix: number

    Returns CIDRBlock

Properties

networkPrefix

networkPrefix: number

Accessors

broadcastAddress

  • get broadcastAddress(): string
  • Return the broadcast address of this CIDR block.

    Returns string

maxAddressIndex

  • get maxAddressIndex(): number
  • Return the maximum address index usable with CIDRBlock.getAddress

    Returns number

networkAddress

  • get networkAddress(): string
  • Returns string

Methods

getAddress

  • getAddress(i: number): string

ipAddress

  • ipAddress(): IterableIterator<string>
  • Return a generator yielding all the IP address this block can contain. It doesn't yield the network address and the broadcast address.

    Returns IterableIterator<string>

split

  • split(requiredSubnetAmount: number): CIDRBlock[]
  • Split the CIDR block into at least requiredSubnetAmount.

    throws

    If the block can't be divided by at least requiredSubnetAmount or if requiredSubnetAmount is negative

    Parameters

    • requiredSubnetAmount: number

    Returns CIDRBlock[]

    The new CIDR blocks generated from the split

toString

  • toString(): string
  • Return the CIDR notation of this block

    Returns string

Static fromNumbers

  • fromNumbers(a: number, b: number, c: number, d: number, prefix: number): CIDRBlock
  • Construct a CIDRBlock object from four IP component numbers (eg: a.b.c.d) and a prefix. The network address is sanitized by zeroing all the bits after the prefix.

    throws

    If any IP component number is invalid or if the prefix is invalid.

    Parameters

    • a: number
    • b: number
    • c: number
    • d: number
    • prefix: number

    Returns CIDRBlock

Static Protected fromNumbersInner

  • fromNumbersInner(a: number, b: number, c: number, d: number, prefix: number): ICIDRBlockArgs
  • Parameters

    • a: number
    • b: number
    • c: number
    • d: number
    • prefix: number

    Returns ICIDRBlockArgs

Static fromString

  • Parse a string into a CIDR block.

    throws

    If the stirng is not a valid CIDR block

    Parameters

    • cidr: string

    Returns CIDRBlock

Static Protected fromStringInner

  • Parameters

    • cidr: string

    Returns ICIDRBlockArgs

Generated using TypeDoc