ipv6 support
This commit is contained in:
parent
15345db261
commit
763e2359ae
1 changed files with 4 additions and 1 deletions
|
|
@ -59,7 +59,10 @@ def check_rate_limit(key, now):
|
||||||
|
|
||||||
async def check_port_is_open(ip, port):
|
async def check_port_is_open(ip, port):
|
||||||
|
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
if ":" in ip:
|
||||||
|
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
|
||||||
|
else:
|
||||||
|
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))
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue