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

fix: Only use IPv4 address without dual mode #44

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

Conversation

imerr
Copy link
Contributor

@imerr imerr commented Feb 13, 2023

Previously, if the DNS resolve returned an IPv6 address as the first entry it would use that Notable for connecting to "localhost" which resolves to ::1 (ipv6) first on windows

Previously, if the DNS resolve returned an IPv6 address as the first entry it would use that
Notable for connecting to "localhost" which resolves to ::1 (ipv6) first on windows
@miwarnec
Copy link
Collaborator

checking the KcpClient.Connect().
it uses the addresses[0].AddressFamily:
2023-02-20 - 12-59-03@2x

in theory, it should make connect work even if resolve gives ipv4 or ipv6.
what are we missing here?

@imerr
Copy link
Contributor Author

imerr commented Feb 20, 2023

Even though you connect to the right address family, the server might not be listening on that address family

For example the case of connecting to "localhost" with dual mode off
Start server, that listens to 127.0.0.1 only (not ::1)
Client resolves localhost to ["::1", "127.0.0.1"]
Attempts to connect to "::1" since that is the first address returned
Connection fails since there's no socket listening for ipv6, only ipv4

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