Rev1913, Support local address other than 127.0.0.1

This commit is contained in:
shortcutme 2017-02-16 20:56:07 +01:00
parent 39734dfadb
commit d57d82f439
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
6 changed files with 20 additions and 11 deletions

View file

@ -116,7 +116,7 @@ class Connection(object):
def handleIncomingConnection(self, sock):
self.log("Incoming connection...")
self.type = "in"
if self.ip != "127.0.0.1": # Clearnet: Check implicit SSL
if self.ip not in config.ip_local: # Clearnet: Check implicit SSL
try:
if sock.recv(1, gevent.socket.MSG_PEEK) == "\x16":
self.log("Crypt in connection using implicit SSL")
@ -176,7 +176,7 @@ class Connection(object):
else:
crypt_supported = CryptConnection.manager.crypt_supported
# No peer id for onion connections
if self.ip.endswith(".onion") or self.ip == "127.0.0.1":
if self.ip.endswith(".onion") or self.ip in config.ip_local:
peer_id = ""
else:
peer_id = self.server.peer_id

View file

@ -29,7 +29,7 @@ class ConnectionServer:
self.tor_manager = None
self.connections = [] # Connections
self.whitelist = ("127.0.0.1",) # No flood protection on this ips
self.whitelist = config.ip_local # No flood protection on this ips
self.ip_incoming = {} # Incoming connections from ip in the last minute to avoid connection flood
self.broken_ssl_peer_ids = {} # Peerids of broken ssl connections
self.ips = {} # Connection by ip