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


Python TCPHiddenServiceEndpoint.system_tor方法代码示例

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


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

示例1: test_system_tor

# 需要导入模块: from txtorcon import TCPHiddenServiceEndpoint [as 别名]
# 或者: from txtorcon.TCPHiddenServiceEndpoint import system_tor [as 别名]
    def test_system_tor(self):
        from test_torconfig import FakeControlProtocol

        def boom(*args):
            # why does the new_callable thing need a callable that
            # returns a callable? Feels like I must be doing something
            # wrong somewhere...
            def bam(*args, **kw):
                return self.protocol
            return bam
        with patch('txtorcon.endpoints.launch_tor') as launch_mock:
            with patch('txtorcon.endpoints.build_tor_connection', new_callable=boom) as btc:
                client = clientFromString(
                    self.reactor,
                    "tcp:host=localhost:port=9050"
                )
                ep = yield TCPHiddenServiceEndpoint.system_tor(self.reactor,
                                                               client, 80)
                port = yield ep.listen(NoOpProtocolFactory())
                toa = port.getHost()
                self.assertTrue(hasattr(toa, 'onion_uri'))
                self.assertTrue(hasattr(toa, 'onion_port'))
                port.startListening()
                str(port)
                port.tor_config
                # system_tor should be connecting to a running one,
                # *not* launching a new one.
                self.assertFalse(launch_mock.called)
开发者ID:coffeemakr,项目名称:txtorcon,代码行数:30,代码来源:test_endpoints.py

示例2: test_progress_updates_system_tor

# 需要导入模块: from txtorcon import TCPHiddenServiceEndpoint [as 别名]
# 或者: from txtorcon.TCPHiddenServiceEndpoint import system_tor [as 别名]
 def test_progress_updates_system_tor(self, ftb):
     control_ep = Mock()
     control_ep.connect = Mock(return_value=defer.succeed(None))
     directlyProvides(control_ep, IStreamClientEndpoint)
     ep = TCPHiddenServiceEndpoint.system_tor(self.reactor, control_ep, 1234)
     ep._tor_progress_update(40, "FOO", "foo to bar")
     return ep
开发者ID:felipedau,项目名称:txtorcon,代码行数:9,代码来源:test_endpoints.py

示例3: __test_progress_updates_system_tor

# 需要导入模块: from txtorcon import TCPHiddenServiceEndpoint [as 别名]
# 或者: from txtorcon.TCPHiddenServiceEndpoint import system_tor [as 别名]
 def __test_progress_updates_system_tor(self):
     ep = TCPHiddenServiceEndpoint.system_tor(self.reactor, 1234)
     ep._tor_progress_update(40, "FOO", "foo to bar")
     return ep
开发者ID:coffeemakr,项目名称:txtorcon,代码行数:6,代码来源:test_endpoints.py


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