MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / start

Method start

src/Tor/TorManager.py:62–82  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

60 self.proxy_port = int(self.proxy_port)
61
62 def start(self):
63 self.log.debug("Starting (Tor: %s)" % config.tor)
64 self.starting = True
65 try:
66 if not self.connect():
67 raise Exception("No connection")
68 self.log.debug("Tor proxy port %s check ok" % config.tor_proxy)
69 except Exception as err:
70 if sys.platform.startswith("win") and os.path.isfile(self.tor_exe):
71 self.log.info("Starting self-bundled Tor, due to Tor proxy port %s check error: %s" % (config.tor_proxy, err))
72 # Change to self-bundled Tor ports
73 self.port = 49051
74 self.proxy_port = 49050
75 if config.tor == "always":
76 socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", self.proxy_port)
77 self.enabled = True
78 if not self.connect():
79 self.startTor()
80 else:
81 self.log.info("Disabling Tor, because error while accessing Tor proxy at port %s: %s" % (config.tor_proxy, err))
82 self.enabled = False
83
84 def setStatus(self, status):
85 self.status = status

Callers 6

tor_managerFunction · 0.95
replacerMethod · 0.45
BenchmarkSsl.pyFile · 0.45
listenFunction · 0.45
listenMethod · 0.45
all.jsFile · 0.45

Calls 2

connectMethod · 0.95
startTorMethod · 0.95

Tested by 3

tor_managerFunction · 0.76
listenFunction · 0.36
listenMethod · 0.36