mirror of https://github.com/fail2ban/fail2ban
CIDR represenation if IPAddr object is a network prefix
parent
941a2b6c82
commit
1b21f21c22
|
@ -203,10 +203,15 @@ class IPAddr(object):
|
|||
self._raw = ipstring
|
||||
|
||||
def __repr__(self):
|
||||
if self.isIPv4 and self.plen < 32:
|
||||
return "%s/%d" % (self.ntoa, self.plen)
|
||||
elif self.isIPv6 and self.plen < 128:
|
||||
return "%s/%d" % (self.ntoa, self.plen)
|
||||
else:
|
||||
return self.ntoa
|
||||
|
||||
def __str__(self):
|
||||
return self.ntoa
|
||||
return self.__repr__()
|
||||
|
||||
@property
|
||||
def addr(self):
|
||||
|
|
Loading…
Reference in New Issue