Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for "edge-case" ip notations #142

Open
StoneLabs opened this issue Jul 20, 2021 · 1 comment
Open

Support for "edge-case" ip notations #142

StoneLabs opened this issue Jul 20, 2021 · 1 comment

Comments

@StoneLabs
Copy link

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

@beaugunderson
Copy link
Owner

beaugunderson commented Jul 20, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants