mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Fix for isIPV6 on platforms that don't support IPV6.
This commit is contained in:
parent
aa7408c09b
commit
ed7748492f
@ -181,6 +181,20 @@ def isIPV6(s):
|
||||
try:
|
||||
return bool(socket.inet_pton(socket.AF_INET6, s))
|
||||
except socket.error:
|
||||
try:
|
||||
socket.inet_pton(socket.AF_INET6, '::')
|
||||
except socket.error:
|
||||
# We gotta fake it.
|
||||
if s.count('::') <= 1:
|
||||
L = s.split(':')
|
||||
if len(L) <= 8:
|
||||
for x in L:
|
||||
if x:
|
||||
try:
|
||||
int(x, 16)
|
||||
except ValueError:
|
||||
return False
|
||||
return True
|
||||
return False
|
||||
|
||||
def banmask(hostmask):
|
||||
|
Loading…
Reference in New Issue
Block a user