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 #@staticmethod
def isValidIP(string): def isValidIP(string):
# Return true if str is a valid IP # Return true if str is a valid IP
s = string.split('/', 1) s = string.split('/', 1)
# try to convert to ipv4 # try to convert to ipv4
try: try:
socket.inet_aton(s[0]) socket.inet_aton(s[0])
return True return True
except socket.error: except socket.error:
# if it had failed try to convert ipv6 # if it had failed try to convert ipv6
try: try:
socket.inet_pton(socket.AF_INET6, s[0]) socket.inet_pton(socket.AF_INET6, s[0])
return True return True
except socket.error: except socket.error:
# not a valid address in both stacks # not a valid address in both stacks
return False return False
isValidIP = staticmethod(isValidIP) isValidIP = staticmethod(isValidIP)
#@staticmethod #@staticmethod