simnet.py 文件源码

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

项目:py-linux-traffic-control 作者: yassen-itlabs 项目源码 文件源码
def determine_all_rates(upload, download):
    tcp_all_rate = False  # serves as flag too
    udp_all_rate = False  # serves as flag too
    for groups in (upload, download):
        if not groups:
            continue
        for group in groups:
            # parsed = parse_branch(group)
            parsed = BranchParser(group, dontcare=True).as_dict()  # in this case we don't care for direction
            if parsed['range'] == 'all' and parsed['protocol'] == 'tcp':
                if tcp_all_rate:
                    raise ParserError("More than one 'all' range detected for the same protocol (tcp).")
                tcp_all_rate = parsed['rate']
            elif parsed['range'] == 'all' and parsed['protocol'] == 'udp':
                if udp_all_rate:
                    raise ParserError("More than one 'all' range detected for the same protocol (udp).")
                udp_all_rate = parsed['rate']
    return tcp_all_rate, udp_all_rate
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号