Socket.Helpers (sockets v2.1.7)

Copy Markdown

A collection of macros that reduce boilerplate across the socket modules.

Summary

Functions

Returns true if host is a valid IPv4 or IPv6 address tuple. See is_ipv4_address/1 and is_ipv6_address/1 for the exact constraints on each format.

Returns true if host is a valid IPv4 address represented as a 4-element tuple where each element is an integer in the range 0..255, e.g. {192, 168, 1, 1}.

Returns true if host is a valid IPv6 address represented as an 8-element tuple where each element is an integer in the range 0..65535, e.g. {8193, 3512, 0, 0, 0, 0, 0, 1}.

Functions

defbang(arg)

(macro)

defbang(arg, list)

(macro)

definvalid(arg)

(macro)

defwrap(arg, options \\ [])

(macro)

is_ip_address(host)

(macro)

Returns true if host is a valid IPv4 or IPv6 address tuple. See is_ipv4_address/1 and is_ipv6_address/1 for the exact constraints on each format.

is_ipv4_address(host)

(macro)
@spec is_ipv4_address(tuple()) :: boolean()

Returns true if host is a valid IPv4 address represented as a 4-element tuple where each element is an integer in the range 0..255, e.g. {192, 168, 1, 1}.

is_ipv6_address(host)

(macro)
@spec is_ipv6_address(tuple()) :: boolean()

Returns true if host is a valid IPv6 address represented as an 8-element tuple where each element is an integer in the range 0..65535, e.g. {8193, 3512, 0, 0, 0, 0, 0, 1}.