Unverified Commit 4b61c6b6 authored by Yunfeng Bai's avatar Yunfeng Bai Committed by GitHub
Browse files

`get_ip()`: Fix ipv4 ipv6 dualstack (#2408)

parent 79d64c49
...@@ -58,7 +58,9 @@ def in_wsl() -> bool: ...@@ -58,7 +58,9 @@ def in_wsl() -> bool:
def get_ip() -> str: 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
return s.getsockname()[0]
def get_open_port() -> int: def get_open_port() -> int:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment