当前位置: 首页>>代码示例>>Python>>正文


Python Router.flags方法代码示例

本文整理汇总了Python中txtorcon.router.Router.flags方法的典型用法代码示例。如果您正苦于以下问题:Python Router.flags方法的具体用法?Python Router.flags怎么用?Python Router.flags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在txtorcon.router.Router的用法示例。


在下文中一共展示了Router.flags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_repr

# 需要导入模块: from txtorcon.router import Router [as 别名]
# 或者: from txtorcon.router.Router import flags [as 别名]
 def test_repr(self):
     router = Router(FakeController())
     router.update("foo",
                   "AHhuQ8zFQJdT8l42Axxc6m6kNwI",
                   "MAANkj30tnFvmoh7FsjVFr+cmcs",
                   "2011-12-16 15:11:34",
                   "1.2.3.4",
                   "24051", "24052")
     router.flags = ['Named']
     repr(router)
开发者ID:arlolra,项目名称:txtorcon,代码行数:12,代码来源:test_router.py

示例2: test_flags_from_string

# 需要导入模块: from txtorcon.router import Router [as 别名]
# 或者: from txtorcon.router.Router import flags [as 别名]
 def test_flags_from_string(self):
     controller = object()
     router = Router(controller)
     router.update("foo",
                   "AHhuQ8zFQJdT8l42Axxc6m6kNwI",
                   "MAANkj30tnFvmoh7FsjVFr+cmcs",
                   "2011-12-16 15:11:34",
                   "77.183.225.114",
                   "24051", "24052")
     router.flags = "Exit Fast Named Running V2Dir Valid"
     self.assertEqual(router.name_is_unique, True)
开发者ID:arlolra,项目名称:txtorcon,代码行数:13,代码来源:test_router.py

示例3: test_unique_name

# 需要导入模块: from txtorcon.router import Router [as 别名]
# 或者: from txtorcon.router.Router import flags [as 别名]
 def test_unique_name(self):
     controller = object()
     router = Router(controller)
     router.update("foo",
                   "AHhuQ8zFQJdT8l42Axxc6m6kNwI",
                   "MAANkj30tnFvmoh7FsjVFr+cmcs",
                   "2011-12-16 15:11:34",
                   "77.183.225.114",
                   "24051", "24052")
     self.assertEqual(router.id_hex, "$00786E43CCC5409753F25E36031C5CEA6EA43702")
     self.assertEqual(router.unique_name, "$00786E43CCC5409753F25E36031C5CEA6EA43702")
     router.flags = ['Named']
     self.assertEqual(router.unique_name, "foo")
开发者ID:arlolra,项目名称:txtorcon,代码行数:15,代码来源:test_router.py

示例4: _create_router

# 需要导入模块: from txtorcon.router import Router [as 别名]
# 或者: from txtorcon.router.Router import flags [as 别名]
    def _create_router(self, **kw):
        id_hex = hexIdFromHash(kw['idhash'])
        try:
            router = self.routers[id_hex]
        except KeyError:
            router = Router(self.protocol)
            self.routers[router.id_hex] = router
        router.from_consensus = True
        router.update(
            kw['nickname'],
            kw['idhash'],
            kw['orhash'],
            kw['modified'],
            kw['ip'],
            kw['orport'],
            kw['dirport'],
        )
        router.flags = kw.get('flags', [])
        if 'bandwidth' in kw:
            router.bandwidth = kw['bandwidth']
        if 'ip_v6' in kw:
            router.ip_v6.extend(kw['ip_v6'])

        if 'guard' in router.flags:
            self.guards[router.id_hex] = router
        if 'authority' in router.flags:
            self.authorities[router.name] = router

        if router.id_hex in self.routers:
            # FIXME should I do an update() on this one??
            router = self.routers[router.id_hex]
        else:
            if router.name in self.routers:
                self.routers[router.name] = None

            else:
                self.routers[router.name] = router

        if router.name in self.routers_by_name:
            self.routers_by_name[router.name].append(router)

        else:
            self.routers_by_name[router.name] = [router]

        self.routers[router.id_hex] = router
        self.routers_by_hash[router.id_hex] = router
        self.all_routers.add(router)
开发者ID:felipedau,项目名称:txtorcon,代码行数:49,代码来源:torstate.py


注:本文中的txtorcon.router.Router.flags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。