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

_tent/ipv6_adapter_cmd
Yaroslav Halchenko 2012-11-08 18:07:39 -05:00
parent 1423de45be
commit 1a19fd8ee0
1 changed files with 13 additions and 13 deletions

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