def __str__(self):
all_subnets = True
for ip in self.dst_ip:
all_subnets = all_subnets and ip.prefixlen() not in [32, 128]
more_than_one = len(self.dst_ip) > 1
if all_subnets:
tpl = "Destination IP must fall into {}"
else:
if more_than_one:
tpl = "Destination IP must be in {}"
else:
tpl = "Destination IP must be {}"
return tpl.format(self._str_list())
评论列表
文章目录