LuCI.network. Hosts

The LuCI.network.Hosts class encapsulates host information aggregated from multiple sources and provides convenience functions to access the host information by different criteria.

Methods

getHostnameByIP6Addr(ip6addr) → {null|string}

Look up the hostname associated with the given IPv6 address.

Parameters:
NameTypeDescription
ip6addrstring

The IPv6 address to look up.

Returns:

Returns the hostname associated with the given IPv6 or null if no matching host could be found or if no hostname is known for the corresponding host.

Type: 
null | string

getHostnameByIPAddr(ipaddr) → {null|string}

Look up the hostname associated with the given IPv4 address.

Parameters:
NameTypeDescription
ipaddrstring

The IPv4 address to look up.

Returns:

Returns the hostname associated with the given IPv4 or null if no matching host could be found or if no hostname is known for the corresponding host.

Type: 
null | string

getHostnameByMACAddr(mac) → {null|string}

Look up the hostname associated with the given MAC address.

Parameters:
NameTypeDescription
macstring

The MAC address to look up.

Returns:

Returns the hostname associated with the given MAC or null if no matching host could be found or if no hostname is known for the corresponding host.

Type: 
null | string

getIP6AddrByMACAddr(mac) → {null|string}

Look up the IPv6 address associated with the given MAC address.

Parameters:
NameTypeDescription
macstring

The MAC address to look up.

Returns:

Returns the IPv6 address associated with the given MAC or null if no matching host could be found or if no IPv6 address is known for the corresponding host.

Type: 
null | string

getIPAddrByMACAddr(mac) → {null|string}

Look up the IPv4 address associated with the given MAC address.

Parameters:
NameTypeDescription
macstring

The MAC address to look up.

Returns:

Returns the IPv4 address associated with the given MAC or null if no matching host could be found or if no IPv4 address is known for the corresponding host.

Type: 
null | string

getMACAddrByIP6Addr(ip6addr) → {null|string}

Look up the MAC address associated with the given IPv6 address.

Parameters:
NameTypeDescription
ip6addrstring

The IPv6 address to look up.

Returns:

Returns the MAC address associated with the given IPv6 or null if no matching host could be found or if no MAC address is known for the corresponding host.

Type: 
null | string

getMACAddrByIPAddr(ipaddr) → {null|string}

Look up the MAC address associated with the given IPv4 address.

Parameters:
NameTypeDescription
ipaddrstring

The IPv4 address to look up.

Returns:

Returns the MAC address associated with the given IPv4 or null if no matching host could be found or if no MAC address is known for the corresponding host.

Type: 
null | string

getMACHints(preferIp6opt) → {Array.<Array.<string>>}

Return an array of (MAC address, name hint) tuples sorted by MAC address.

Parameters:
NameTypeAttributesDefaultDescription
preferIp6boolean<optional>
false

Whether to prefer IPv6 addresses (true) or IPv4 addresses (false) as name hint when no hostname is known for a specific MAC address.

Returns:

Returns an array of arrays containing a name hint for each found MAC address on the system. The array is sorted ascending by MAC.

Each item of the resulting array is a two element array with the MAC being the first element and the name hint being the second element. The name hint is either the hostname, an IPv4 or an IPv6 address related to the MAC address.

If no hostname but both IPv4 and IPv6 addresses are known, the preferIP6 flag specifies whether the IPv6 or the IPv4 address is used as hint.

Type: 
Array.<Array.<string>>