(self, onion, port)
| 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 |
no test coverage detected