mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-14 05:26:28 +00:00
Add windows support to is_ip
This commit is contained in:
parent
ba4ca111c6
commit
0e4101a9a3
@ -553,6 +553,10 @@ def is_ip(ip):
|
||||
import socket
|
||||
#first we test ipv4
|
||||
try:
|
||||
if windows_check():
|
||||
if socket.inet_aton("%s" % (ip)):
|
||||
return True
|
||||
else:
|
||||
if socket.inet_pton(socket.AF_INET, "%s" % (ip)):
|
||||
return True
|
||||
except socket.error:
|
||||
@ -560,6 +564,10 @@ def is_ip(ip):
|
||||
return False
|
||||
#now test ipv6
|
||||
try:
|
||||
if windows_check():
|
||||
log.warning("ipv6 check unavailable on windows")
|
||||
return True
|
||||
else:
|
||||
if socket.inet_pton(socket.AF_INET6, "%s" % (ip)):
|
||||
return True
|
||||
except socket.error:
|
||||
|
Loading…
x
Reference in New Issue
Block a user