Choose from current hidden services if over tor_hs_limit
This commit is contained in:
parent
16bfb35109
commit
75d94aaf06
1 changed files with 7 additions and 3 deletions
|
@ -5,11 +5,12 @@ import binascii
|
|||
import sys
|
||||
import os
|
||||
import time
|
||||
|
||||
import gevent
|
||||
import random
|
||||
import subprocess
|
||||
import atexit
|
||||
|
||||
import gevent
|
||||
|
||||
from Config import config
|
||||
from Crypt import CryptRsa
|
||||
from Site import SiteManager
|
||||
|
@ -208,6 +209,9 @@ class TorManager(object):
|
|||
self.log.error("Tor reset circuits error: %s" % res)
|
||||
|
||||
def addOnion(self):
|
||||
if len(self.privatekeys) >= config.tor_hs_limit:
|
||||
return random.choice(self.privatekeys.keys())
|
||||
|
||||
result = self.makeOnionAndKey()
|
||||
if result:
|
||||
onion_address, onion_privatekey = result
|
||||
|
@ -305,4 +309,4 @@ class TorManager(object):
|
|||
sock = socks.socksocket()
|
||||
sock.set_proxy(socks.SOCKS5, self.proxy_ip, self.proxy_port)
|
||||
sock.connect((onion, int(port)))
|
||||
return sock
|
||||
return sock
|
Loading…
Reference in a new issue