ipv6 support

This commit is contained in:
Kay0u 2020-04-11 16:08:14 +02:00
parent 15345db261
commit 763e2359ae
No known key found for this signature in database
GPG key ID: AE1DCADB6415A156

View file

@ -59,6 +59,9 @@ def check_rate_limit(key, now):
async def check_port_is_open(ip, port): async def check_port_is_open(ip, port):
if ":" in ip:
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
else:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(2) sock.settimeout(2)
result = sock.connect_ex((ip, port)) result = sock.connect_ex((ip, port))