std.anystr2ip
Available inall subroutines.
Converts the string addr
to an IP address (IPv4 or IPv6). If conversion fails,
fallback
will be returned.
This function accepts a wider range of formats than
std.str2ip
: Each number may be specified
in hexadecimal (0x...
), octal (0...
), or decimal format. There may be
fewer than four numbers, in which case the last number is responsible for the
remaining bytes of the IP. For example,0x8.010.2056
is equivalent to
8.8.8.8
.
We recommend using a fallback IP address that's meaningful for your particular Fastly service.
Example
if (std.anystr2ip("0xc0.0.01001", "192.0.2.2") ~ my_acl) { ...}