IP
The IP
type represents both IPv4 and IPv6 addresses.
These are individual addresses, with no netmask.
Literals may be given in a variety of formats
using the usual dotted quad for IPv4 and colon-separated IPv6.
For example:
declare local var.ip IP;set var.ip = "192.0.2.0";set var.ip = "2001:db8::1";set var.ip = "2002:c000:0204::"; /* 6to4 mapping for "192.0.2.4" */set var.ip = "::FFFF:192.0.2.4"; /* IPv4 mapping for "192.0.2.4" */set var.ip = "::1";set var.ip = "::"; /* unspecified address */
Short forms for IPv4 are not permitted:
declare local var.ip IP;set var.ip = "192.2.0"; /* invalid; would be equivalent to "192.0.2.0" */set var.ip = "127.1"; /* invalid; would be equivalent to "127.0.0.1" */set var.ip = "0"; /* invalid; would be equivalent to "0.0.0.0" */
User contributed notes
BETADo you see an error in this page? Do have an interesting use case, example or edge case people should know about? Share your knowledge and help people who are reading this page! (Comments are moderated; for support, please contact support@fastly.com)