View Source z_ip_address (zotonic_stdlib v1.23.1)

Misc utility URL functions for zotonic

Summary

Functions

Check if an IP address matches a list of addresses and masks like "127.0.0.0/8,10.0.0.0/8,fe80::/10"

An IP address is local if it matches "127.0.0.0/8,10.0.0.0/8,192.168.0.0/16,172.16.0.0/12,169.254.0.0/16,::1,fd00::/8,fe80::/10,100.64.0.0/10"

Check if the host name resolves to a local IP address.

Functions

ip_match(IP, IPs)

-spec ip_match(undefined | string() | binary() | tuple(),
               local | any | none | list() | string() | binary()) ->
                  boolean().

Check if an IP address matches a list of addresses and masks like "127.0.0.0/8,10.0.0.0/8,fe80::/10"

is_local(_)

-spec is_local(inet:ip_address()) -> boolean().

An IP address is local if it matches "127.0.0.0/8,10.0.0.0/8,192.168.0.0/16,172.16.0.0/12,169.254.0.0/16,::1,fd00::/8,fe80::/10,100.64.0.0/10"

is_local_name(Name)

-spec is_local_name(string() | binary()) -> boolean().

Check if the host name resolves to a local IP address.