beaugunderson/ip-address

Support for "edge-case" ip notations

StoneLabs opened this issue · 1 comments

Currently, there seem to be quite a lot of valid IPs that throw [AddressError]: Invalid IPv4 address.

var Address4 = require('ip-address').Address4;

// All of the following are rejected as invalid.
const topic = new Address4('127.1'); // equivalent to 127.0.0.1
const topic = new Address4('127.0.1'); // equivalent to 127.0.0.1
const topic = new Address4('192.168.36095'); // equivalent to 192.168.140.255 in CLASS B notation
const topic = new Address4('192.11046143');  // equivalent to 192.168.140.255 in CLASS C notation
const topic = new Address4('0xc0.0xa8.0x8c.0xff');  // equivalent to 192.168.140.255 in valid hex notation
const topic = new Address4('0300.0250.0214.0377');  // equivalent to 192.168.140.255 in valid oct notation (though some implementations ignore oct notation)
const topic = new Address4('0000000001.0000000002.0000000003.000000010');  // equivalent to 1.2.3.8 in valid oct notation (though some implementations ignore oct notation)

// Granted, these are all very absurd notations. However, all of these are valid ip's. you can verify this just pinging them.

image
image