socks proxy support, disable udp connections support, http bittorrent tracker support, port opened, external ip to stats, only need zeroname site if dont have, dont try to download file that not in content.json, store external ip even if port closed, recreate uirequest class to avoid unfinished requests in some cases

This commit is contained in:
HelloZeroNet 2015-04-12 23:59:22 +02:00
parent b414a75885
commit 4f7e048413
36 changed files with 1927 additions and 80 deletions

View file

@ -102,6 +102,9 @@ class FileRequest:
if config.debug_socket: self.log.debug("Sending file %s from position %s to %s" % (file_path, params["location"], back["location"]))
self.response(back)
if config.debug_socket: self.log.debug("File %s sent" % file_path)
# Add peer to site if not added before
# site.addPeer(self.connection.ip, self.connection.port)
except Exception, err:
self.log.debug("GetFile read error: %s" % Debug.formatException(err))
self.response({"error": "File read error: %s" % Debug.formatException(err)})

View file

@ -74,7 +74,12 @@ class FileServer(ConnectionServer):
self.log.info("[BAD :(] Port closed: %s" % message)
if port == self.port:
self.port_opened = False # Self port, update port_opened status
config.ip_external = False
match = re.match(".*?([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)", message) # Try find my external ip in message
if match: # Found my ip in message
config.ip_external = match.group(1)
SiteManager.peer_blacklist.append((config.ip_external, self.port)) # Add myself to peer blacklist
else:
config.ip_external = False
return {"result": False, "message": message}
else:
self.log.info("[OK :)] Port open: %s" % message)