-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 ipv4 ipv6 dualstack #2408
Fix ipv4 ipv6 dualstack #2408
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fix makes a lot of sense. i do wonder whether this work across public interface, private interface, and k8s based system
@@ -58,7 +58,9 @@ def in_wsl() -> bool: | |||
|
|||
|
|||
def get_ip() -> str: | |||
return socket.gethostbyname(socket.gethostname()) | |||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |||
s.connect(("8.8.8.8", 80)) # Doesn't need to be reachable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happen if it is not reachable? will it timeout/error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i tried some other non-reachable addresses and this still works
tested in k8s cluster and it fixes |
@simon-mo @yunfeng-scale I encountered the same issue ( I use |
Fixes #2407
socket.getaddrinfo
only returns IPv6 addresses