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

Method createSocket

src/Tor/TorManager.py:296–308  ·  view source on GitHub ↗
(self, onion, port)

Source from the content-addressed store, hash-verified

294 # Creates and returns a
295 # socket that has connected to the Tor Network
296 def createSocket(self, onion, port):
297 if not self.enabled:
298 return False
299 self.log.debug("Creating new Tor socket to %s:%s" % (onion, port))
300 if self.starting:
301 self.log.debug("Waiting for startup...")
302 self.event_started.get()
303 if config.tor == "always": # Every socket is proxied by default, in this mode
304 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
305 else:
306 sock = socks.socksocket()
307 sock.set_proxy(socks.SOCKS5, self.proxy_ip, self.proxy_port)
308 return sock

Callers 2

actionCheckportMethod · 0.45
getRandomPortMethod · 0.45

Calls 1

getMethod · 0.45

Tested by

no test coverage detected