mirror of https://github.com/fail2ban/fail2ban
BF: tabifying back isValidIP -- fail2ban uses tabs (historical reason)
parent
1423de45be
commit
1a19fd8ee0
|
@ -619,19 +619,19 @@ class DNSUtils:
|
|||
#@staticmethod
|
||||
def isValidIP(string):
|
||||
# Return true if str is a valid IP
|
||||
s = string.split('/', 1)
|
||||
# try to convert to ipv4
|
||||
try:
|
||||
socket.inet_aton(s[0])
|
||||
return True
|
||||
except socket.error:
|
||||
# if it had failed try to convert ipv6
|
||||
try:
|
||||
socket.inet_pton(socket.AF_INET6, s[0])
|
||||
return True
|
||||
except socket.error:
|
||||
# not a valid address in both stacks
|
||||
return False
|
||||
s = string.split('/', 1)
|
||||
# try to convert to ipv4
|
||||
try:
|
||||
socket.inet_aton(s[0])
|
||||
return True
|
||||
except socket.error:
|
||||
# if it had failed try to convert ipv6
|
||||
try:
|
||||
socket.inet_pton(socket.AF_INET6, s[0])
|
||||
return True
|
||||
except socket.error:
|
||||
# not a valid address in both stacks
|
||||
return False
|
||||
isValidIP = staticmethod(isValidIP)
|
||||
|
||||
#@staticmethod
|
||||
|
|
Loading…
Reference in New Issue