Skip to content

Class: SubnetList

Defined in: SubnetList.ts:22

Represents a network comprised of subnets.

Implements

Constructors

Constructor

new SubnetList(subnets?): SubnetList

Defined in: SubnetList.ts:65

Creates a new network.

Parameters

subnets?

Iterable<Subnet<IP>, any, any>

Initial subnets to add to this network.

Returns

SubnetList

Properties

BOGON

readonly static BOGON: SubnetList

Defined in: SubnetList.ts:26

A network of reserved subnets. This network does not contain publicly routable IP addresses.

Methods

[iterator]()

[iterator](): Iterator<IP>

Defined in: SubnetList.ts:71

Iterates over all IP addresses in this network.

Returns

Iterator<IP>

Implementation of

Network.[iterator]


add()

Call Signature

add(subnet): boolean

Defined in: SubnetList.ts:83

Adds a subnet to this network.

Parameters
subnet

Subnet<IP>

Subnet to add.

Returns

boolean

Whether the subnet was not already fully in the network.

Call Signature

add(ip): boolean

Defined in: SubnetList.ts:91

Adds an IP address to this network.

Parameters
ip

IP

IP address to add.

Returns

boolean

Whether the IP address was not already in the network.

Call Signature

add(subnets): void

Defined in: SubnetList.ts:98

Adds a subnet list to this network.

Parameters
subnets

SubnetList

Network of subnets to add.

Returns

void


contains()

contains(address): boolean

Defined in: SubnetList.ts:168

Checks if an IP address is in this network.

Parameters

address

IP

IP address to check.

Returns

boolean

Implementation of

Network.contains


hasSubnet()

hasSubnet(subnet): boolean

Defined in: SubnetList.ts:152

Checks if a subnet is in this network.

Parameters

subnet

Subnet<IP>

Subnet to check.

Returns

boolean


remove()

remove(subnet): boolean

Defined in: SubnetList.ts:133

Removes a subnet from this network.

Parameters

subnet

Subnet<IP>

Subnet to remove.

Returns

boolean

Whether the subnet was found and removed.


size()

size(): bigint

Defined in: SubnetList.ts:176

Returns the number of addresses in this network.

Returns

bigint

Implementation of

Network.size


subnets()

subnets(): Subnet<IP>[]

Defined in: SubnetList.ts:159

Returns all subnets in this network.

Returns

Subnet<IP>[]

Released under the LGPL-3.0 licence.