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 sys
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
import random
|
||||||
import gevent
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import atexit
|
import atexit
|
||||||
|
|
||||||
|
import gevent
|
||||||
|
|
||||||
from Config import config
|
from Config import config
|
||||||
from Crypt import CryptRsa
|
from Crypt import CryptRsa
|
||||||
from Site import SiteManager
|
from Site import SiteManager
|
||||||
|
@ -208,6 +209,9 @@ class TorManager(object):
|
||||||
self.log.error("Tor reset circuits error: %s" % res)
|
self.log.error("Tor reset circuits error: %s" % res)
|
||||||
|
|
||||||
def addOnion(self):
|
def addOnion(self):
|
||||||
|
if len(self.privatekeys) >= config.tor_hs_limit:
|
||||||
|
return random.choice(self.privatekeys.keys())
|
||||||
|
|
||||||
result = self.makeOnionAndKey()
|
result = self.makeOnionAndKey()
|
||||||
if result:
|
if result:
|
||||||
onion_address, onion_privatekey = result
|
onion_address, onion_privatekey = result
|
||||||
|
|
Loading…
Reference in a new issue