ipcidrmatcher.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:pscheduler 作者: perfsonar 项目源码 文件源码
def contains(self, ip_address):
        "Try to match a candidate ip_address and see whether it was in the list of allowed cidrs"

        ip_address = netaddr.IPNetwork(ip_address)

        result = False
        for cidr in self.cidr:
            net = netaddr.IPNetwork(cidr)

            if ip_address in net:
                result = True
                break

        if self.invert:
            return not result
        return result


# Test program
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号