Don't connect to private ip addresses in tor always mode
This commit is contained in:
parent
c2edbb30b5
commit
566b689ca6
1 changed files with 3 additions and 0 deletions
|
@ -13,6 +13,7 @@ from Config import config
|
|||
from Debug import Debug
|
||||
from util import StreamingMsgpack
|
||||
from Crypt import CryptConnection
|
||||
from util import helper
|
||||
|
||||
|
||||
class Connection(object):
|
||||
|
@ -104,6 +105,8 @@ class Connection(object):
|
|||
if not self.server.tor_manager or not self.server.tor_manager.enabled:
|
||||
raise Exception("Can't connect to onion addresses, no Tor controller present")
|
||||
self.sock = self.server.tor_manager.createSocket(self.ip, self.port)
|
||||
elif config.tor == "always" and helper.isPrivateIp(self.ip) and self.ip not in config.ip_local:
|
||||
raise Exception("Can't connect to local IPs in Tor: always mode")
|
||||
else:
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
|
|
Loading…
Reference in a new issue