-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add canonicalize function, add ipv6 option to host() (now returns v4 … #2
base: master
Are you sure you want to change the base?
Conversation
…by default), add tests
I read over this and it seems like a good change. Inconsistent binding and dialing has been an issue in the last and I feel like v4 Loopback will be around for a while. |
I'm related to this issue in many ways so I need to comment:
I'm quite sure The PR ssbc/multiserver#51 that @cryptix referred to is fixing a different issue than this, though, it's simply propagating initialization errors up, whether they are related to IPv6 or not shouldn't matter. Much more relevant is the PR ssbc/multiserver#52 which fixes multiserver to bind to private IPv6 addresses.
Yes, I discovered this too, and ended up fixing this in |
@staltz I dug a little deeper. This fails with EADDRNOTAVAIL on macOS
And in fact this works:
Not sure how and where to fix this though. Moving forward, it would be nice to support v6. EDIT ok, that's exactly what you address in ssbc/multiserver#52 I see! |
@staltz The question remains: How do we get those private IPv6 addresses with zone id (the suffix)? I was hoping that the numeric function getPrivateIPv6() {
return Object.values(os.networkInterfaces())
.reduce((acc, x)=>{return acc.concat(x)}, [])
.filter(iface=>iface.address.toLowerCase().startsWith('fe80'))
.map(iface=>{
return `${iface.address}%${iface.scopeid}`
})
}
console.log(getPrivateIPv6())
/* ==>
[
'fe80::1%1',
'fe80::c68:c821:a021:676d%5',
'fe80::14f3:23ff:feb5:1251%7',
'fe80::a858:f8e9:aadd:ec4c%10'
]
*/ also yield EADDRNOTAVAIL when passed to |
Yes! But on Android |
In the worst case, you could still fork |
@staltz yes, using the interface name as suffix works on macOS, as described above. The stack overflow article you linked to in your PR though sounds like Windows is using numeric scope ids (like |
Yep, OS-level quirks should have been sorted out underneath |
Maybe relevant, but in my multiserver PR I've removed all scoped IPv6 addresses and the build is passing on win/mac/linux: |
More context: the latest PR obsoletes multiserver-scopes in general, so I'd love thoughts/feels/opinions about this comment/PR: ssbc/multiserver#49 (comment) |
@christianbundy do you mean your PR removes just that module or the idea of scopes? |
Just removes this module ("multiserver-scopes"), not "multiserver scopes". 😬 |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? |
I ran into an issue on macOS, where multiserver's net plugin would try to bind to my private ipv6 address and failed with
EADDRUNAVAIL
. The reason could be that, implicitly, we create an ipv4net
server that cannot bind to v6 addresses. (We could create a v6 server however ... but I have not investigated this further)Anyway, I was surprised that multiserver-scopes would return ipv6 addresses by default, it both (v4 and v6) are available and figured it probably shouldn't. With this PR
host()
returns v4 addresses. However, i you want an ipv6 address, you can use the new options argument, e.g.:host('private', {ipv6: true})
host()
host()
now returns v4 by default)