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

displayIP alters outcome of inRange #16

Open
fishcharlie opened this issue Nov 28, 2017 · 1 comment
Open

displayIP alters outcome of inRange #16

fishcharlie opened this issue Nov 28, 2017 · 1 comment

Comments

@fishcharlie
Copy link

The following code prints false then true. Passing an IP in using rangeCheck.displayIP shouldn't alter the outcome of rangeCheck.inRange

var rangeCheck = require('range_check');
let cloudflareips = [
	"103.21.244.0/22",
	"103.22.200.0/22",
	"103.31.4.0/22",
	"104.16.0.0/12",
	"108.162.192.0/18",
	"131.0.72.0/22",
	"141.101.64.0/18",
	"162.158.0.0/15",
	"172.64.0.0/13",
	"173.245.48.0/20",
	"188.114.96.0/20",
	"190.93.240.0/20",
	"197.234.240.0/22",
	"198.41.128.0/17",
	"2400:cb00::/32",
	"2405:8100::/32",
	"2405:b500::/32",
	"2606:4700::/32",
	"2803:f800::/32",
	"2c0f:f248::/32",
	"2a06:98c0::/29"
];
console.log(rangeCheck.inRange("::ffff:172.68.34.38", cloudflareips)); //false
console.log(rangeCheck.inRange(rangeCheck.displayIP("::ffff:172.68.34.38"), cloudflareips)); //true
@keverw
Copy link
Owner

keverw commented Jun 30, 2020

Recently started using this project again since using it in internal project, and converted it to Typescript. The general idea of those functions to make different varieties more IPs searchable.

::ffff:172.68.34.38 is being normalized as 172.68.34.38
https://tehnoblog.org/ip-tools/ip-address-in-cidr-range/
IP Address 172.68.34.38 is in CIDR range 172.64.0.0/13

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