JS API Reference

Class: Network

network/network.Network

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Network(id, ip, mask?, gateway?): Network

Parameters

NameType
idstring
ipstring
mask?string
gateway?string

Returns

Network

Defined in

src/network/network.ts:27

Properties

id

Readonly id: string

Defined in

src/network/network.ts:28

Methods

getNetworkInfo

getNetworkInfo(): NetworkInfo

Returns information about the network.

Returns

NetworkInfo

Defined in

src/network/network.ts:45


addNode

addNode(node): void

Adds a node to the network.

Parameters

NameTypeDescription
nodeNetworkNodeThe network node to be added.

Returns

void

Defined in

src/network/network.ts:59


hasNode

hasNode(node): boolean

Checks whether the node belongs to the network.

Parameters

NameTypeDescription
nodeNetworkNodeThe network node to check.

Returns

boolean

Defined in

src/network/network.ts:80


removeNode

removeNode(node): void

Removes a node from the network.

Parameters

NameTypeDescription
nodeNetworkNodeThe network node to be removed.

Returns

void

Defined in

src/network/network.ts:88


markAsRemoved

markAsRemoved(): void

Returns

void

Defined in

src/network/network.ts:102


getFirstAvailableIpAddress

getFirstAvailableIpAddress(): IPv4

Returns the first available IP address in the network.

Returns

IPv4

Defined in

src/network/network.ts:112


isIpInNetwork

isIpInNetwork(ip): boolean

Checks if a given IP address is within the network range.

Parameters

NameTypeDescription
ipIPv4The IPv4 address to check.

Returns

boolean

Defined in

src/network/network.ts:127


isNodeIdUnique

isNodeIdUnique(id): boolean

Checks if a given node ID is unique within the network.

Parameters

NameTypeDescription
idstringThe node ID to check.

Returns

boolean

Defined in

src/network/network.ts:135


isNodeIpUnique

isNodeIpUnique(ip): boolean

Checks if a given IP address is unique within the network.

Parameters

NameType
ipIPv4

Returns

boolean

Defined in

src/network/network.ts:142


isRemoved

isRemoved(): boolean

Returns

boolean

Defined in

src/network/network.ts:149