net.interfaces
net.interfaces
Function
reads the local network interface information.
Syntax
net.interfaces()
Parameters
has no parameters.
Return Value
| Type | Description |
|---|---|
| Array | Returns an array of network interface information objects. |
Each object in the interface object field
array represents a network address.
| Field | Type | Must exist | Description |
|---|---|---|---|
| name | String | Yes | The name of the interface. The current implementation returns default for the default egress address and loopback for the local loopback address. |
| ip | String | Yes | IP address string, such as 192.168.1.10 or 127.0.0.1. |
| family | String | Yes | IP address family. This may currently be IPv4 or IPv6. |
| internal | Bool | Yes | Whether it is an internal address. true represents the internal address of the local machine such as loopback; false represents the default export address. |
Examples
// Read the local network interface list. list = net.interfaces() first = list[0] // Output the IP address of the first interface. result = first.ip //Output example: 192.168.1.10 print result
Notes
- The current implementation contains default egress IP and loopback information.