IPAddress

IPAddress

Represent an IP address. Includes helper functions to keep you on track

Constructor

new IPAddress(address, portopt)

This is the constructor
Source:
Parameters:
Name Type Attributes Description
address string Can either be the ip address, or the ip address with :port (in which case leave `port` blank)
port int <optional>
The port, leave blank if appended to the ip address

Methods

getIPAddress() → {string}

This will return the IPAddress
Source:
Returns:
Type:
string

getPort() → {int}

This will return the port number
Source:
Returns:
Type:
int

isValidIPAddress(address) → {boolean}

This checks if the IPAdress is valid
Source:
Parameters:
Name Type Description
address string
Returns:
Type:
boolean

isValidPort(port) → {boolean}

This checks if the port number is valid
Source:
Parameters:
Name Type Description
port string | number
Returns:
Type:
boolean

setIPAddress(address) → {void}

This will set the IPAddress and port number
Source:
Parameters:
Name Type Description
address string
Returns:
Type:
void

setPort(port) → {void}

This will set the port number
Source:
Parameters:
Name Type Description
port int
Returns:
Type:
void

toString() → {string}

Returns the IP address as a string
Source:
Returns:
Type:
string