BF: tabifying back isValidIP -- fail2ban uses tabs (historical reason)

This commit is contained in:
Yaroslav Halchenko 2012-11-08 18:07:39 -05:00
parent 1423de45be
commit 1a19fd8ee0

View file

@ -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