IP Address
Path:
/src/type/ipaddr.coffee
compiled to/lib/type/ipaddr.js
The value has to be an IP address.
Check options:
optional
-Boolean
the value must not be present (will return null)default
-String
the value to use if none givenversion
-String
one of ‘ipv4’ or ‘ipv6’ and the value will be converted, if possibleallow
-Array
the allowed ip rangesdeny
-Array
the denied ip ranges
Format options:
format
-String
compression method to use: ‘short’, ‘long’
The addresses may be converted from IPv6 to IPv4 and from IPv4 to IPv6 if possible.
Ranges for deny
and allow
may contain a list of multiple IP ranges which are
given in with the IP address and the significant bits behind: ‘127.0.0.1/8’ or as
a range name.
Range names are: unspecified, broadcast, multicast, linklocal, loopback, private,
reserved, uniquelocal, ipv4mapped, rfc6145, rfc6052, 6to4, teredo.
Or use the range ‘special’ to specify all of the named ranges.
has allow | has deny | in allow | in deny | in both | in other |
---|---|---|---|---|---|
no | no | - | - | - | ok |
yes | no | ok | - | - | fail |
no | yes | - | fail | - | ok |
yes | yes | ok | fail | ok | ok |
The output will always be without leading ‘0’ and by default compressed to the short form for IPv6 addresses. To get the long form use the ‘format’ option.
Schema Specification
IP Address is an ip address schema definition.
An object with the following keys allowed: version
, ipv4Mapping
, deny
, allow
, format
, title
, description
, key
, type
, optional
, default
. The following entries have a specific format:
version
-
IP Type is the ip address version to use. .
A text entry which is optional. All control characters will be removed. Only the values: ‘ipv4’, ‘ipv6’ are allowed.
ipv4Mapping
-
Map IPv4 to IPv6 is the default value to use if nothing given.
A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.
deny
-
Deny Addresses are a list of addresses or ranges to deny.
A list which is optional. Each entry has to be of type string:
Deny Address is the address or range to deny.
A text entry in which all control characters will be removed. The text should match: /^unspecified|broadcast|multicast|linklocal|loopback|private|reserved|uniquelocal|ipv4mapped|rfc(6145|6052)|6to4|teredo|special|(|([0-9a-fA-F]{1,4}{7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}{1,7}([0-9a-fA-F]{1,4}{1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}{1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}{1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}{1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}{1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}{0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}{1,4}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/(12[0-8]|(1[01][0-9]){0,1}[0-9])|(((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/(3[0-2]|[12]{0,1}[0-9])$/.
allow
-
Allow Addresses are a list of addresses or ranges to allow.
A list which is optional. Each entry has to be of type string:
Allow Address is the address or range to allow.
A text entry in which all control characters will be removed. The text should match: /^unspecified|broadcast|multicast|linklocal|loopback|private|reserved|uniquelocal|ipv4mapped|rfc(6145|6052)|6to4|teredo|special|(|([0-9a-fA-F]{1,4}{7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}{1,7}([0-9a-fA-F]{1,4}{1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}{1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}{1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}{1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}{1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}{0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}{1,4}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/(12[0-8]|(1[01][0-9]){0,1}[0-9])|(((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/(3[0-2]|[12]{0,1}[0-9])$/.
format
-
Format is the display format tu use.
A text entry which is optional and will be set to
'short'
if not specified. All control characters will be removed. Only the values: ‘short’, ‘long’ are allowed. title
-
Title is the title used to describe the element.
A text entry which is optional. All control characters will be removed.
description
-
Description is the free description of the element.
A text entry which is optional. All control characters will be removed.
key
-
Binding to Keyname is the mapping to which key names in an object this element belongs.
A valid regular expression which is optional. It has to be one of the following types:
- An object which has to be an instance of class
RegExp
. - A text entry in which all control characters will be removed. The text should match: /^/.?/[gim]$/.
- An object which has to be an instance of class
type
-
Type is the type of element.
A text entry in which all control characters will be removed.
optional
-
Optional is a flag defining if this element is optional.
A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.
default
-
Default Value is the default value to use if nothing given.
A text entry which is optional. All control characters will be removed. The text should match: /^(([0-9a-fA-F]{1,4}{7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}{1,7}([0-9a-fA-F]{1,4}{1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}{1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}{1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}{1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}{1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}(:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}{0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}{1,4}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))|(((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]).){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/.