From 490db87ce6f22ff13a266f95cbef33e3f59c31aa Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Thu, 27 Oct 2022 16:16:37 -0400 Subject: [PATCH] DOCS: Clarify IPv6 variables are strings (#1775) Co-authored-by: Jeffrey Cafferata --- docs/_functions/global/IP.md | 17 +++++++++++++++-- docs/examples.md | 6 ++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/_functions/global/IP.md b/docs/_functions/global/IP.md index 5f0dbe944..aa79cd6ab 100644 --- a/docs/_functions/global/IP.md +++ b/docs/_functions/global/IP.md @@ -6,8 +6,6 @@ parameters: Converts an IPv4 address from string to an integer. This allows performing mathematical operations with the IP address. -This does not accept IPv6 addresses. (PRs gladly accepted.) - {% capture example %} ```js var addrA = IP('1.2.3.4') @@ -17,3 +15,18 @@ var addrB = addrA + 1 {% endcapture %} {% include example.html content=example %} + +NOTE: `IP()` does not accept IPv6 addresses (PRs gladly accepted!). IPv6 addresses are simply strings: + +{% capture example2 %} +```js +// IPv4 Var +var addrA1 = IP("1.2.3.4"); +var addrA2 = "1.2.3.4"; + +// IPv6 Var +var addrAAAA = "0:0:0:0:0:0:0:0"; +``` +{% endcapture %} + +{% include example.html content=example2 %} diff --git a/docs/examples.md b/docs/examples.md index 27bee9bd6..7dfb7e6d7 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -53,6 +53,12 @@ D('example.com', REG, DnsProvider('R53'), ) ``` +NOTE: The `IP()` function doesn't currently support IPv6 (PRs welcome!). IPv6 addresses are strings. + +```js +var addrAAAA = "0:0:0:0:0:0:0:0"; +``` + ## Variables to swap active Data Center ```js