summaryrefslogtreecommitdiff
path: root/README.markdown
diff options
context:
space:
mode:
authorJaume Devesa <devvesa@gmail.com>2015-11-19 12:47:01 +0100
committerJaume Devesa <devvesa@gmail.com>2015-11-30 17:34:00 +0100
commitfe23e01a4b8b0cc0d9ea1a958e2be5a947fb7aed (patch)
tree5e65502fba2f155ae377cecb0ee2d89529c0ed3f /README.markdown
parent61333cfc48026af204483d681bd8b10cb44d6fc6 (diff)
Add validator for any IP address
Provide a validator for IP addresses, regardless they are IPv4 or IPv6, and its documentation.
Diffstat (limited to 'README.markdown')
-rw-r--r--README.markdown33
1 files changed, 33 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown
index 9ff242c..526b573 100644
--- a/README.markdown
+++ b/README.markdown
@@ -1079,6 +1079,39 @@ Validates that the first argument is an integer (or an array of integers). Abort
*Type*: statement.
+#### `validate_ip_address`
+
+Validates that argument is an IP address, regardless of it is an IPv4 or an IPv6
+address. It validates as well IP address with netmask. It must be an String, as
+well.
+
+The following values will pass:
+
+ ~~~
+ validate_ip_address('0.0.0.0')
+ validate_ip_address('8.8.8.8')
+ validate_ip_address('127.0.0.1')
+ validate_ip_address('194.232.104.150')
+ validate_ip_address('3ffe:0505:0002::')
+ validate_ip_address('::1/64')
+ validate_ip_address('fe80::a00:27ff:fe94:44d6/64')
+ validate_ip_address('8.8.8.8/32')
+ ~~~
+
+The following values will fail, causing compilation to abort:
+
+ ~~~
+ validate_ip_address(1)
+ validate_ip_address(true)
+ validate_ip_address(0.0.0.256)
+ validate_ip_address('::1', {})
+ validate_ip_address('0.0.0.0.0')
+ validate_ip_address('3.3.3')
+ validate_ip_address('23.43.9.22/64')
+ validate_ip_address('260.2.32.43')
+ ~~~
+
+
#### `validate_numeric`
Validates that the first argument is a numeric value (or an array of numeric values). Aborts catalog compilation if any of the checks fail.