Extended IP Address Validation

Examples:

Objects and Endpoints:

Object: IP

IP can be any of the following Types:

IPv4: "127.0.0.1"
IPv4Historic: "1.0x2.01404"
IPv6: "::A:b:C:d:E:f"
IPv6v4: "d0d:d0d:d0d:d0d:d0d:d0d:13.13.13.13"

print
Object: Print

Example

"print": {
	"parsed": "a:b:c:d:e:0:0.0.1.2",
	"ipv4": "0.0.1.2",
	"ipv4historic": "0.0.1.2",
	"ipv6short": "a:b:c:d:e::102",
	"ipv6v4short": "a:b:c:d:e:0:0.0.1.2",
	"ipv6long": "000a:000b:000c:000d:000e:0000:0000:0102",
	"ipv6v4long": "000a:000b:000c:000d:000e:0000:0.0.1.2"
}
blocks
[]Object: Block

Example

"blocks": [
	{
		"size": 16,
		"base": 16,
		"number": 10,
		"correct": true
	},
	{
		"size": 16,
		"base": 16,
		"number": 11,
		"correct": true
	},
	{
		"size": 16,
		"base": 16,
		"number": 12,
		"correct": true
	},
	{
		"size": 16,
		"base": 16,
		"number": 13,
		"correct": true
	},
	{
		"size": 16,
		"base": 16,
		"number": 14,
		"correct": true
	},
	{
		"size": 16,
		"base": 16,
		"correct": true
	},
	{
		"size": 8,
		"base": 10,
		"correct": true
	},
	{
		"size": 8,
		"base": 10,
		"correct": true
	},
	{
		"size": 8,
		"base": 10,
		"number": 1,
		"correct": true
	},
	{
		"size": 8,
		"base": 10,
		"number": 2,
		"correct": true
	}
]
bytes
[]Number
Bytes are Numbers! Bytes are NOT Base64 Encoded!

Example

"bytes": [
	0,
	10,
	0,
	11,
	0,
	12,
	0,
	13,
	0,
	14,
	0,
	0,
	0,
	0,
	1,
	2
]
version
Number

Constants

Key Value
4 IPv4
6 IPv6


Example

"version": 6
doublecolon-v6
Number
IPv6 DoubleColon Starting Point
Only Exists for IPv6, Default is 0 for non IPv6
IPv6 Double Colon Exists: Starts at 0
IPv6 Double Colon Does NOT Exist: -1

Example

"doublecolon-v6": 5
doublecolon-v6v4
Number
IPv6v4 DoubleColon Starting Point
Only Exists for IPv6, Default is 0 for non IPv6
IPv6v4 Double Colon Exists: Starts at 0
IPv6v4 Double Colon Does NOT Exist: -1

Example

"doublecolon-v6v4": -1
private
Boolean
Does this IP Address belong to a Private Network?

Example

"private": false
loopback
Boolean
Does this IP Address belong to a Loopback Network?

Example

"loopback": false
linklocal
Boolean
Does this IP Address belong to a Link-local Network?

Example

"linklocal": false
reserved
Boolean
Does this IP Address belong to a Reserved Network?

Example

"reserved": false
correct
Boolean
Was Input Correct to the Spec?

Example

"correct": true

Object Examples: IP

IPv4 Input: "127.009.09.9"
{
	"print": {
		"parsed": "127.009.09.9",
		"ipv4": "127.9.9.9",
		"ipv4historic": "127.9.9.9",
		"ipv6short": "::ffff:7f09:909",
		"ipv6v4short": "::ffff:127.9.9.9",
		"ipv6long": "0000:0000:0000:0000:0000:ffff:7f09:0909",
		"ipv6v4long": "0000:0000:0000:0000:0000:ffff:127.9.9.9"
	},
	"blocks": [
		{
			"size": 8,
			"base": 10,
			"number": 127,
			"correct": true
		},
		{
			"size": 8,
			"base": 10,
			"number": 9,
			"pads": 2
		},
		{
			"size": 8,
			"base": 10,
			"number": 9,
			"pads": 1
		},
		{
			"size": 8,
			"base": 10,
			"number": 9,
			"correct": true
		}
	],
	"bytes": [
		127,
		9,
		9,
		9
	],
	"version": 4,
	"loopback": true,
	"reserved": true
}
IPv6v4 Input: "13:d0d::1337:0.0.208.13"
{
	"print": {
		"parsed": "13:d0d::1337:0.0.208.13",
		"ipv4": "0.0.208.13",
		"ipv4historic": "0.0.208.13",
		"ipv6short": "13:d0d::1337:0:d00d",
		"ipv6v4short": "13:d0d::1337:0.0.208.13",
		"ipv6long": "0013:0d0d:0000:0000:0000:1337:0000:d00d",
		"ipv6v4long": "0013:0d0d:0000:0000:0000:1337:0.0.208.13"
	},
	"blocks": [
		{
			"size": 16,
			"base": 16,
			"number": 19,
			"correct": true
		},
		{
			"size": 16,
			"base": 16,
			"number": 3341,
			"correct": true
		},
		{
			"base": 16,
			"correct": true,
			"position": 1
		},
		{
			"base": 16,
			"correct": true,
			"position": 1
		},
		{
			"base": 16,
			"correct": true,
			"position": 1
		},
		{
			"size": 16,
			"base": 16,
			"number": 4919,
			"correct": true,
			"position": 2
		},
		{
			"size": 8,
			"base": 10,
			"correct": true,
			"position": 2
		},
		{
			"size": 8,
			"base": 10,
			"correct": true,
			"position": 2
		},
		{
			"size": 8,
			"base": 10,
			"number": 208,
			"correct": true,
			"position": 2
		},
		{
			"size": 8,
			"base": 10,
			"number": 13,
			"correct": true,
			"position": 2
		}
	],
	"bytes": [
		0,
		19,
		13,
		13,
		0,
		0,
		0,
		0,
		0,
		0,
		19,
		55,
		0,
		0,
		208,
		13
	],
	"version": 6,
	"doublecolon-v6": 2,
	"doublecolon-v6v4": 2,
	"correct": true
}

Object: IP Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
print
Object: Print_Options
blocks
Object: Block_Options
bytes
Boolean
version
Boolean
doublecolon-v6
Boolean
doublecolon-v6v4
Boolean
private
Boolean
loopback
Boolean
linklocal
Boolean
reserved
Boolean
correct
Boolean

Object Examples: IP Options

Default Options:
{
	"print": {
		"parsed": true,
		"ipv4": true,
		"ipv4historic": true,
		"ipv6short": true,
		"ipv6v4short": true,
		"ipv6long": true,
		"ipv6v4long": true
	},
	"blocks": {
		"print": null,
		"size": true,
		"base": true,
		"number": true,
		"pads": true,
		"correct": true,
		"position": true
	},
	"bytes": true,
	"version": true,
	"doublecolon-v6": true,
	"doublecolon-v6v4": true,
	"correct": true,
	"private": true,
	"loopback": true,
	"linklocal": true,
	"reserved": true
}

Object: Block

Blocks can be any of the following Types:
IPv4
Size: uint8
Base: Decimal
IPv4Historic
Size: uint8, uint16, uint24, or uint32
Base: Octal, Decimal, or Hexadecimal
IPv6
Size: uint16
Base: Hexadecimal
IPv6v4
Size: uint8
Base: Decimal
print
Object: Print

Example

"print": {
	"parsed": "0d0d",
	"ipv4": "13.13",
	"ipv4historic": "13.13",
	"ipv6short": "d0d",
	"ipv6v4short": "13.13",
	"ipv6long": "0d0d",
	"ipv6v4long": "13.13"
}
size
Number

Constants

Key Value
8 uint8
16 uint16
24 uint24
32 uint32


Example

"size": 16
base
Number

Constants

Key Value
8 OCTAL
10 DECIMAL
16 HEXADECIMAL


Example

"base": 16
number
Number
Decimal Value of Block

Example

"number": 3341
pads
Number
Number of Zeroes Padded
IPv4/IPv4H Padding is not a part of the standard. IPv6 Padding is allowed but is not considered Valid.

Example

"pads": 1
correct
Boolean
Was Input Correct to the Spec?

Example

"correct": true
position
Number
IPv6/IPv6v4 Block Position


Constants

Key Value
0 Before Double Colon
This is the default for IPv4/IPv4Historic
1 Padding Inside of a Double Colon
2 After Double Colon
If the last block is Before Double Colon, Double Colon doesn't exist!


Example

"position": 0

Object Examples: Block

IPv4 Input: "127.0.0.1"
{
	"size": 8,
	"base": 10,
	"number": 127,
	"correct": true
}
IPv4Historic Hexadecimal Input: "0x12345678"
{
	"size": 32,
	"base": 16,
	"number": 305419896,
	"correct": true
}
IPv4Historic Octal Input: "255.07654321"'
{
	"size": 24,
	"base": 8,
	"number": 2054353,
	"correct": true
}
IPv6 Input: "::ABC"'
{
	"size": 16,
	"base": 16,
	"number": 2748,
	"correct": true
}

Object: Block Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
print
Object: Print_Options
size
Boolean
base
Boolean
number
Boolean
pads
Boolean
correct
Boolean
position
Boolean

Object: Print

IP and Block both use this Object for Printing

parsed
String
Print as Parsed

If Block was Padded, Value will contain Pads!
If Block contained an invalid Double Colon its invalid position will be included.

Example

"parsed": "0x12345678" // no padding
"parsed": "0x012345678" // padded
"parsed": "00cc" // padded
"parsed": "1:00ff:0:000:0000:1337::255.013.64.001" // padded
ipv4
String
Print as IPv4

If IP is an IPv6, all but the last 32 bits are trimmed.

Example

"ipv4": "18.52.86.120"
"ipv4": "255.13.64.1" // ipv6
ipv4historic
String
Print as IPv4Historic

Only IPv4Historic of types Octal/Hexadecimal will be printed in their Original Type. All others will be printed in Decimal.
If IP is an IPv6, all but the last 32 bits are trimmed.

Example

"ipv4historic": "127.0.0.1" // ipv4 decimal
"ipv4historic": "0x12345678" // ipv4h hex
"ipv4historic": "037777777777" // ipv4h octal
"ipv4historic": "255.13.64.1" // ipv6
ipv6short
String
Print as IPv6Short

Example

"ipv6short": "1234:5678" // ipv4
"ipv6short": "1:ff::1337:ff0d:4001"
ipv6v4short
String
Print as IPv6v4Short

Example

"ipv6v4short": "18.52.86.120" // ipv4
"ipv6v4short": "1:ff::1337:255.13.64.1"
ipv6long
String
Print as IPv6Long

Example

"ipv6long": "1234:5678" // ipv4
"ipv6long": "0001:00ff:0000:0000:0000:1337:ff0d:4001"
ipv6v4long
String
Print as IPv6v4Long

Example

"ipv6v4long": "18.52.86.120" // ipv4
"ipv6v4long": "0001:00ff:0000:0000:0000:1337:255.13.64.1"

Object Examples: Print

IPv4 Input: "127.0.0.1"
{
	"parsed": "127.0.0.1",
	"ipv4": "127.0.0.1",
	"ipv4historic": "127.0.0.1",
	"ipv6short": "::ffff:7f00:1",
	"ipv6v4short": "::ffff:127.0.0.1",
	"ipv6long": "0000:0000:0000:0000:0000:ffff:7f00:0001",
	"ipv6v4long": "0000:0000:0000:0000:0000:ffff:127.0.0.1"
}
IPv4Historic Input: "0xFFFFFFFF"
{
	"parsed": "0xffffffff",
	"ipv4": "255.255.255.255",
	"ipv4historic": "0xffffffff",
	"ipv6short": "::ffff:ffff:ffff",
	"ipv6v4short": "::ffff:255.255.255.255",
	"ipv6long": "0000:0000:0000:0000:0000:ffff:ffff:ffff",
	"ipv6v4long": "0000:0000:0000:0000:0000:ffff:255.255.255.255"
}
IPv6v4 Input: "1:00ff:0:000:0000:1337::255.013.64.001"
{
	"parsed": "1:00ff:0:000:0000:1337::255.013.64.001",
	"ipv4": "255.13.64.1",
	"ipv4historic": "255.13.64.1",
	"ipv6short": "1:ff::1337:ff0d:4001",
	"ipv6v4short": "1:ff::1337:255.13.64.1",
	"ipv6long": "0001:00ff:0000:0000:0000:1337:ff0d:4001",
	"ipv6v4long": "0001:00ff:0000:0000:0000:1337:255.13.64.1"
}

Object: Print_Options

IP and Block both use this Object for Options

POST APIs only support setting Options. Attributes are displayed when set to true.
GET APIs return the Default set Options.
parsed
Boolean
ipv4
Boolean
ipv4historic
Boolean
ipv6short
Boolean
ipv6v4short
Boolean
ipv6long
Boolean
ipv6v4long
Boolean