本文整理汇总了Python中txtorcon.TorConfig.HiddenServices方法的典型用法代码示例。如果您正苦于以下问题:Python TorConfig.HiddenServices方法的具体用法?Python TorConfig.HiddenServices怎么用?Python TorConfig.HiddenServices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类txtorcon.TorConfig
的用法示例。
在下文中一共展示了TorConfig.HiddenServices方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hidden_service_same_directory
# 需要导入模块: from txtorcon import TorConfig [as 别名]
# 或者: from txtorcon.TorConfig import HiddenServices [as 别名]
def test_hidden_service_same_directory(self):
conf = TorConfig(FakeControlProtocol(['config/names=']))
servicelines = '''HiddenServiceDir=/fake/path
HiddenServiceDir=/fake/path'''
self.assertRaises(RuntimeError, conf._setup_hidden_services, servicelines)
conf = TorConfig()
conf.HiddenServices = [HiddenService(conf, '/fake/path', ['80 127.0.0.1:1234'])]
conf.HiddenServices.append(HiddenService(conf, '/fake/path', ['80 127.0.0.1:1234']))
self.assertTrue(conf.needs_save())
self.assertRaises(RuntimeError, conf.save)
conf = TorConfig()
conf.HiddenServices = [HiddenService(conf, '/fake/path', ['80 127.0.0.1:1234'])]
conf.HiddenServices.append(HiddenService(conf, '/fake/path/two', ['80 127.0.0.1:1234']))
self.assertTrue(conf.needs_save())
conf.save()
conf.hiddenservices[1].dir = '/fake/path'
self.assertTrue(conf.needs_save())
self.assertRaises(RuntimeError, conf.save)
示例2: test_save_no_protocol
# 需要导入模块: from txtorcon import TorConfig [as 别名]
# 或者: from txtorcon.TorConfig import HiddenServices [as 别名]
def test_save_no_protocol(self):
conf = TorConfig()
conf.HiddenServices = [HiddenService(conf, '/fake/path', ['80 127.0.0.1:1234'])]
conf.save()
示例3: test_two_hidden_services_before_save
# 需要导入模块: from txtorcon import TorConfig [as 别名]
# 或者: from txtorcon.TorConfig import HiddenServices [as 别名]
def test_two_hidden_services_before_save(self):
conf = TorConfig()
conf.HiddenServices = [HiddenService(conf, '/fake/path', ['80 127.0.0.1:1234'])]
conf.HiddenServices.append(HiddenService(conf, '/fake/path/two', ['1234 127.0.0.1:1234']))
conf.save()
self.assertEqual(2, len(conf.HiddenServices))