本文整理汇总了Python中txtorcon.TorConfig._setup_hidden_services方法的典型用法代码示例。如果您正苦于以下问题:Python TorConfig._setup_hidden_services方法的具体用法?Python TorConfig._setup_hidden_services怎么用?Python TorConfig._setup_hidden_services使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类txtorcon.TorConfig
的用法示例。
在下文中一共展示了TorConfig._setup_hidden_services方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hidden_service_parse_error
# 需要导入模块: from txtorcon import TorConfig [as 别名]
# 或者: from txtorcon.TorConfig import _setup_hidden_services [as 别名]
def test_hidden_service_parse_error(self):
conf = TorConfig(FakeControlProtocol(['config/names=']))
try:
conf._setup_hidden_services('''FakeHiddenServiceKey=foo''')
self.fail()
except RuntimeError, e:
self.assertTrue('parse' in str(e))
示例2: test_multiple_startup_services
# 需要导入模块: from txtorcon import TorConfig [as 别名]
# 或者: from txtorcon.TorConfig import _setup_hidden_services [as 别名]
def test_multiple_startup_services(self):
conf = TorConfig(FakeControlProtocol(['config/names=']))
conf._setup_hidden_services('''HiddenServiceDir=/fake/path
HiddenServicePort=80 127.0.0.1:1234
HiddenServiceVersion=2
HiddenServiceAuthorizeClient=basic
HiddenServiceDir=/some/other/fake/path
HiddenServicePort=80 127.0.0.1:1234
HiddenServicePort=90 127.0.0.1:2345''')
self.assertEqual(len(conf.hiddenservices), 2)
self.assertEqual(conf.hiddenservices[0].dir, '/fake/path')
self.assertEqual(conf.hiddenservices[0].version, 2)
self.assertEqual(conf.hiddenservices[0].authorize_client, 'basic')
self.assertEqual(len(conf.hiddenservices[0].ports), 1)
self.assertEqual(conf.hiddenservices[0].ports[0], '80 127.0.0.1:1234')
self.assertEqual(conf.hiddenservices[1].dir, '/some/other/fake/path')
self.assertEqual(len(conf.hiddenservices[1].ports), 2)
self.assertEqual(conf.hiddenservices[1].ports[0], '80 127.0.0.1:1234')
self.assertEqual(conf.hiddenservices[1].ports[1], '90 127.0.0.1:2345')
示例3: test_hidden_service_directory_absolute_path
# 需要导入模块: from txtorcon import TorConfig [as 别名]
# 或者: from txtorcon.TorConfig import _setup_hidden_services [as 别名]
def test_hidden_service_directory_absolute_path(self):
conf = TorConfig(FakeControlProtocol(['config/names=']))
conf._setup_hidden_services('HiddenServiceDir=/fake/path/../path')
self.assertEqual(len(self.flushWarnings()), 1)