Module tch.inet
Common IP address functions.
Functions
hexIPv4ToString(hexip) | Convert the given hexadecimal IPv4 address string to dotted decimal notation. |
isValidIP(ip) | Check if the given address is a valid IP address. |
isValidIPv4(ip) | Check if the given address is a valid IPv4 address. |
isValidIPv6(ip) | Check if the given address is a valid IPv6 address. |
Functions
- hexIPv4ToString(hexip)
-
Convert the given hexadecimal IPv4 address string to
dotted decimal notation. The string may have leading or
trailing whitespace.
Parameters:
- hexip string The hexadecimal IPv4 address to be converted.
Returns:
-
string
The IPv4 address in dotted decimal notation.
Or
- nil
- string Error message.
- isValidIP(ip)
-
Check if the given address is a valid IP address.
Parameters:
- ip string The IP address to test.
Returns:
-
string
"IPv4" if
ip
is a valid IPv4 address or "IPv6" ifip
is a valid IPv6 address.Or
- nil
- string Error message.
- isValidIPv4(ip)
-
Check if the given address is a valid IPv4 address.
Parameters:
- ip string The IP address string to test.
Returns:
-
boolean
True if it is a valid IPv4 address.
Or
- nil
- string Error message.
- isValidIPv6(ip)
-
Check if the given address is a valid IPv6 address.
Parameters:
- ip string The IP address string to test.
Returns:
-
boolean
True if it is a valid IPv6 address.
Or
- nil
- string Error message.