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

Implement support of listening on IPv6 #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

p12tic
Copy link
Contributor

@p12tic p12tic commented Nov 26, 2022

Listening on IPv6 in addition to IPv4 requires more complex implementation to handle edge cases:

  • Two separate sockets need to be created for both IPv4 and IPv6, because some operating systems can only create IPV6_V6ONLY sockets by default and there's no way to query this on runtime.

  • The given addresses are resolved to allow listening on localhost on both IPv4 and IPv6 addresses.

Note that previous implementation may already fail on certain scenarios on machines that only have IPv4 outbound connectivity. For example, IPv6 may be enabled for link-local addresses and clients will pick IPv6 address by default when connecting to localhost and fail as beauty server listens only on IPv4 there.

Listening on IPv6 in addition to IPv4 requires more complex
implementation to handle edge cases:

- Two separate sockets need to be created for both IPv4 and IPv6.
because some operating systems can only create IPV6_V6ONLY sockets by
default and there's no way to query this on runtime.

- The given addresses are resolved to allow listening on localhost on
both IPv4 and IPv6 addresses.

Note that previous implementation may already fail on certain scenarios
on machines that only have IPv4 outbound connectivity. For example, IPv6
may be enabled for link-local addresses and clients will pick IPv6
address by default when connecting to localhost and fail as beauty
server listens only on IPv4 there.

// Resolving synchronously because errors should be propagated directly to
// the caller of listen()
auto resolved = resolver.resolve(query);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this one is marked as deprecated (resolver.resolve).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, I didn't notice this, probably because I used older boost. I'll fix this and get back to you.

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.

2 participants