本文整理汇总了Python中txtorcon.TorControlProtocol.get_conf方法的典型用法代码示例。如果您正苦于以下问题:Python TorControlProtocol.get_conf方法的具体用法?Python TorControlProtocol.get_conf怎么用?Python TorControlProtocol.get_conf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类txtorcon.TorControlProtocol
的用法示例。
在下文中一共展示了TorControlProtocol.get_conf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProtocolTests
# 需要导入模块: from txtorcon import TorControlProtocol [as 别名]
# 或者: from txtorcon.TorControlProtocol import get_conf [as 别名]
#.........这里部分代码省略.........
events = b'GUARD STREAM CIRC NS NEWCONSENSUS ORCONN NEWDESC ADDRMAP STATUS_GENERAL'
self.protocol._bootstrap()
# answer all the requests generated by boostrapping etc.
self.send(b"250-signal/names=")
self.send(b"250 OK")
self.send(b"250-version=foo")
self.send(b"250 OK")
self.send(b"250-events/names=" + events)
self.send(b"250 OK")
self.send(b"250 OK") # for USEFEATURE
return d
def test_bootstrap_tor_does_not_support_signal_names(self):
self.protocol._bootstrap()
self.send(b'552 Unrecognized key "signal/names"')
valid_signals = ["RELOAD", "DUMP", "DEBUG", "NEWNYM", "CLEARDNSCACHE"]
self.assertEqual(self.protocol.valid_signals, valid_signals)
def test_async(self):
"""
test the example from control-spec.txt to see that we
handle interleaved async notifications properly.
"""
self.protocol._set_valid_events('CIRC')
self.protocol.add_event_listener('CIRC', lambda _: None)
self.send(b"250 OK")
d = self.protocol.get_conf("SOCKSPORT ORPORT")
self.send(b"650 CIRC 1000 EXTENDED moria1,moria2")
self.send(b"250-SOCKSPORT=9050")
self.send(b"250 ORPORT=0")
return d
def test_async_multiline(self):
# same as above, but i think the 650's can be multline,
# too. Like:
# 650-CIRC 1000 EXTENDED moria1,moria2 0xBEEF
# 650-EXTRAMAGIC=99
# 650 ANONYMITY=high
self.protocol._set_valid_events('CIRC')
self.protocol.add_event_listener(
'CIRC',
CallbackChecker(
"1000 EXTENDED moria1,moria2\nEXTRAMAGIC=99\nANONYMITY=high"
)
)
self.send(b"250 OK")
d = self.protocol.get_conf("SOCKSPORT ORPORT")
d.addCallback(CallbackChecker({"ORPORT": "0", "SOCKSPORT": "9050"}))
self.send(b"650-CIRC 1000 EXTENDED moria1,moria2")
self.send(b"650-EXTRAMAGIC=99")
self.send(b"650 ANONYMITY=high")
self.send(b"250-SOCKSPORT=9050")
self.send(b"250 ORPORT=0")
return d
def test_multiline_plus(self):
"""