-
Notifications
You must be signed in to change notification settings - Fork 3
Socket-based transports: Addresses as URIs #7
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
base: master
Are you sure you want to change the base?
Conversation
|
Good stuff! What do you think about only parsing a URI directly in the implementation of whenIPv6? While I can definitely acknowledge that parseSocketAddress is brain-dead (it got the job done through the early phases of writing the code), I'm not sure yet I'm ready to treat all addresses as URIs. If we just change the definition of whenIPv6 to use a URI to help detect IPv6, then we accomplish the same thing (better detection) with a much smaller change to the overall source. I have thought about using URIs for addresses, and even thought that might help with deciding which transport should be used for a particular Address. That's why there is a Scheme type that isn't utilized much: if used, it would match the scheme portion of a URI (e.g., http, https, tcp, udp, etc.). Thoughts? On Jul 6, 2014, at 11:21 AM, Carlos Valiente [email protected] wrote:
|
Yes, that would also do. That was in fact the way I started toying
... some bits of So up to you to decide, I'd say! I'm using this project mainly in order |
|
Well, thanks for the interest! I think just parsing URIs in the whenIPv6 function would be fine for now; we can save the full URI treatment of Addresses for another day. I'd rather not go all the way treating Addresses as URIs until there has been time to think through the implications. Thank you! On Jul 6, 2014, at 11:21 AM, Carlos Valiente [email protected] wrote:
|
The IPv6 loopback address in my Linux box is usable:
My
/etc/hostsfile, however, does not resolvelocalhostto an IPv6 address:In this setup the current implementation of
whenIPv6fails to activate the IPv6 tests, because it assumes thatlocalhostmust resolve to an IPv6 address in order for IPv6 to be supported:My initial workaround was to pass
::1tolookupAddresses, which would resolve to an IPv6 address, regardless of whatlocalhostresolves to:Unfortunately the current implementation of
parseSocketAddressinNetwork.Transport.Socketsassumes a single colon (if any at all) separating the host name from the port, so the snippet above does not work.Instead of rewriting the address parsing code in
parseSocketAddress, I've sketched this pull requests, which assumes thatAddressvalues are URIs, instead ofhost:portpairs. The version ofparseSocketAddressdelegates all the parsing work toNetwork.URI.parseURI.In this branch I can now run both IPv4 and IPv6 tests:
IPv4-only tests seems to work, too: