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

[WIP] Enable IPv4 tests on Travis - fixes #22 #24

Closed
wants to merge 4 commits into from

Conversation

silverwind
Copy link
Collaborator

No description provided.

@silverwind silverwind changed the title Enable IPv4 tests on Travis - fixes #22 [WIP] Enable IPv4 tests on Travis - fixes #22 Feb 21, 2019
@silverwind
Copy link
Collaborator Author

silverwind commented Feb 21, 2019

Hmm, this is tricky. The CI machine have IP 10.20.0.153/32 with a gateway 10.20.0.1 outside their subnet. In a "normal" network the gateway would be within the subnet and the module currently uses this assumption. Still I think this might classify as a bug, but no idea how to resolve it cleanly besides only partially matching octets which can be inaccurate.

@silverwind
Copy link
Collaborator Author

silverwind commented Feb 23, 2019

One idea would be to return the closest matching interface IP, e.g. convert all interface IPs to numbers and take number closest to the default gateway. Thought it is still only a guess, it would work in this case.

@silverwind
Copy link
Collaborator Author

silverwind commented Feb 23, 2019

I think we could leverage ipaddr#toByteArray to do the number conversion, thought we can obviously not convert is to a pure JS number for IPv6 unless we want to require BigInt support.

@sindresorhus
Copy link
Owner

thought we can obviously not convert is to a pure JS number for IPv6 unless we want to require BigInt support.

https://github.com/GoogleChromeLabs/jsbi

@sindresorhus
Copy link
Owner

Bump :)

@silverwind
Copy link
Collaborator Author

Hmm, maybe I'll have a look later using native BigInt (requires node 10.4+), don't want to use any of those polyfills really.

@silverwind
Copy link
Collaborator Author

Closing this in favor of #27.

@silverwind silverwind closed this Jul 1, 2019
@sindresorhus sindresorhus deleted the travis-ipv4 branch July 1, 2019 16:43
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

Successfully merging this pull request may close these issues.

None yet

2 participants