Class: Network
network/network.Network
Table of contents
Constructors
Properties
Methods
- getNetworkInfo
- addNode
- hasNode
- removeNode
- markAsRemoved
- getFirstAvailableIpAddress
- isIpInNetwork
- isNodeIdUnique
- isNodeIpUnique
- isRemoved
Constructors
constructor
• new Network(id
, ip
, mask?
, gateway?
): Network
Parameters
Name | Type |
---|---|
id | string |
ip | string |
mask? | string |
gateway? | string |
Returns
Defined in
Properties
id
• Readonly
id: string
Defined in
Methods
getNetworkInfo
▸ getNetworkInfo(): NetworkInfo
Returns information about the network.
Returns
Defined in
addNode
▸ addNode(node
): void
Adds a node to the network.
Parameters
Name | Type | Description |
---|---|---|
node | NetworkNode | The network node to be added. |
Returns
void
Defined in
hasNode
▸ hasNode(node
): boolean
Checks whether the node belongs to the network.
Parameters
Name | Type | Description |
---|---|---|
node | NetworkNode | The network node to check. |
Returns
boolean
Defined in
removeNode
▸ removeNode(node
): void
Removes a node from the network.
Parameters
Name | Type | Description |
---|---|---|
node | NetworkNode | The network node to be removed. |
Returns
void
Defined in
markAsRemoved
▸ markAsRemoved(): void
Returns
void
Defined in
getFirstAvailableIpAddress
▸ getFirstAvailableIpAddress(): IPv4
Returns the first available IP address in the network.
Returns
IPv4
Defined in
isIpInNetwork
▸ isIpInNetwork(ip
): boolean
Checks if a given IP address is within the network range.
Parameters
Name | Type | Description |
---|---|---|
ip | IPv4 | The IPv4 address to check. |
Returns
boolean
Defined in
isNodeIdUnique
▸ isNodeIdUnique(id
): boolean
Checks if a given node ID is unique within the network.
Parameters
Name | Type | Description |
---|---|---|
id | string | The node ID to check. |
Returns
boolean
Defined in
isNodeIpUnique
▸ isNodeIpUnique(ip
): boolean
Checks if a given IP address is unique within the network.
Parameters
Name | Type |
---|---|
ip | IPv4 |
Returns
boolean
Defined in
isRemoved
▸ isRemoved(): boolean
Returns
boolean
Defined in
Was this helpful?