v 0.7.6-internal
- Added `access_key` variable in Config, this used to access restrited plugins when multiuser plugin is enabled. When MultiUserPlugin is enabled we cannot access some pages like /Stats, this key will remove such restriction with access key. - Added `last_connection_id_current_version` to ConnectionServer, helpful to estimate no of connection from current client version. - Added current version: connections to /Stats page. see the previous point.
This commit is contained in:
parent
0bbf19aab9
commit
0e48004563
3 changed files with 25 additions and 10 deletions
|
@ -73,14 +73,15 @@ class UiRequestPlugin(object):
|
||||||
import main
|
import main
|
||||||
|
|
||||||
# Connections
|
# Connections
|
||||||
yield "<b>Connections</b> (%s, total made: %s, in: %s, out: %s):<br>" % (
|
yield "<b>Connections</b> (%s, current version: %s, total made: %s, in: %s, out: %s):<br>" % (
|
||||||
len(main.file_server.connections), main.file_server.last_connection_id,
|
len(main.file_server.connections), main.file_server.last_connection_id_current_version, main.file_server.last_connection_id,
|
||||||
main.file_server.num_incoming, main.file_server.num_outgoing
|
main.file_server.num_incoming, main.file_server.num_outgoing
|
||||||
)
|
)
|
||||||
yield "<table class='connections'><tr> <th>id</th> <th>type</th> <th>ip</th> <th>open</th> <th>crypt</th> <th>ping</th>"
|
yield "<table class='connections'><tr> <th>id</th> <th>type</th> <th>ip</th> <th>open</th> <th>crypt</th> <th>ping</th>"
|
||||||
yield "<th>buff</th> <th>bad</th> <th>idle</th> <th>open</th> <th>delay</th> <th>cpu</th> <th>out</th> <th>in</th> <th>last sent</th>"
|
yield "<th>buff</th> <th>bad</th> <th>idle</th> <th>open</th> <th>delay</th> <th>cpu</th> <th>out</th> <th>in</th> <th>last sent</th>"
|
||||||
yield "<th>wait</th> <th>version</th> <th>time</th> <th>sites</th> </tr>"
|
yield "<th>wait</th> <th>version</th> <th>time</th> <th>sites</th> </tr>"
|
||||||
for connection in main.file_server.connections:
|
connections = sorted(main.file_server.connections, key=lambda connection: connection.handshake.get("rev", 0), reverse=True)
|
||||||
|
for connection in connections:
|
||||||
if "cipher" in dir(connection.sock):
|
if "cipher" in dir(connection.sock):
|
||||||
cipher = connection.sock.cipher()[0]
|
cipher = connection.sock.cipher()[0]
|
||||||
tls_version = connection.sock.version()
|
tls_version = connection.sock.version()
|
||||||
|
@ -364,8 +365,14 @@ class UiRequestPlugin(object):
|
||||||
self.sendHeader()
|
self.sendHeader()
|
||||||
|
|
||||||
if "Multiuser" in PluginManager.plugin_manager.plugin_names and not config.multiuser_local:
|
if "Multiuser" in PluginManager.plugin_manager.plugin_names and not config.multiuser_local:
|
||||||
yield "This function is disabled on this proxy"
|
if 'access_key' not in self.get.keys():
|
||||||
return
|
yield "This function is disabled on this proxy"
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
access_key = self.get["access_key"]
|
||||||
|
if access_key != config.access_key:
|
||||||
|
yield "This function is disabled on this proxy"
|
||||||
|
return
|
||||||
|
|
||||||
s = time.time()
|
s = time.time()
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import time
|
||||||
class Config(object):
|
class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.7.5"
|
self.version = "0.7.6-internal"
|
||||||
self.rev = 4560
|
self.rev = 4560
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
|
@ -79,6 +79,8 @@ class Config(object):
|
||||||
|
|
||||||
# Create command line arguments
|
# Create command line arguments
|
||||||
def createArguments(self):
|
def createArguments(self):
|
||||||
|
from Crypt import CryptHash
|
||||||
|
access_key_default = CryptHash.random(24, "base64") # Used to allow restrited plugins when multiuser plugin is enabled
|
||||||
trackers = [
|
trackers = [
|
||||||
"zero://boot3rdez4rzn36x.onion:15441",
|
"zero://boot3rdez4rzn36x.onion:15441",
|
||||||
"http://open.acgnxtracker.com:80/announce", # DE
|
"http://open.acgnxtracker.com:80/announce", # DE
|
||||||
|
@ -97,9 +99,6 @@ class Config(object):
|
||||||
"udp://tracker.0x.tf:6969/announce",
|
"udp://tracker.0x.tf:6969/announce",
|
||||||
"udp://tracker.zerobytes.xyz:1337/announce",
|
"udp://tracker.zerobytes.xyz:1337/announce",
|
||||||
"udp://vibe.sleepyinternetfun.xyz:1738/announce",
|
"udp://vibe.sleepyinternetfun.xyz:1738/announce",
|
||||||
"udp://tracker.bitsearch.to:1337/announce",
|
|
||||||
"udp://jeremylee.sh:6969/announce",
|
|
||||||
"udp://tracker.pomf.se:80/announce",
|
|
||||||
"udp://www.torrent.eu.org:451/announce",
|
"udp://www.torrent.eu.org:451/announce",
|
||||||
"zero://k5w77dozo3hy5zualyhni6vrh73iwfkaofa64abbilwyhhd3wgenbjqd.onion:15441",
|
"zero://k5w77dozo3hy5zualyhni6vrh73iwfkaofa64abbilwyhhd3wgenbjqd.onion:15441",
|
||||||
"zero://2kcb2fqesyaevc4lntogupa4mkdssth2ypfwczd2ov5a3zo6ytwwbayd.onion:15441",
|
"zero://2kcb2fqesyaevc4lntogupa4mkdssth2ypfwczd2ov5a3zo6ytwwbayd.onion:15441",
|
||||||
|
@ -271,6 +270,7 @@ class Config(object):
|
||||||
metavar='address')
|
metavar='address')
|
||||||
self.parser.add_argument('--updatesite', help='Source code update site', default='1Update8crprmciJHwp2WXqkx2c4iYp18',
|
self.parser.add_argument('--updatesite', help='Source code update site', default='1Update8crprmciJHwp2WXqkx2c4iYp18',
|
||||||
metavar='address')
|
metavar='address')
|
||||||
|
self.parser.add_argument('--access_key', help='Plugin access key default: Random key generated at startup', default=access_key_default, metavar='key')
|
||||||
self.parser.add_argument('--dist_type', help='Type of installed distribution', default='source')
|
self.parser.add_argument('--dist_type', help='Type of installed distribution', default='source')
|
||||||
|
|
||||||
self.parser.add_argument('--size_limit', help='Default site size limit in MB', default=10, type=int, metavar='limit')
|
self.parser.add_argument('--size_limit', help='Default site size limit in MB', default=10, type=int, metavar='limit')
|
||||||
|
|
|
@ -30,7 +30,8 @@ class ConnectionServer(object):
|
||||||
port = 15441
|
port = 15441
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
self.port = port
|
self.port = port
|
||||||
self.last_connection_id = 1 # Connection id incrementer
|
self.last_connection_id = 0 # Connection id incrementer
|
||||||
|
self.last_connection_id_current_version = 0 # Connection id incrementer for current client version
|
||||||
self.log = logging.getLogger("ConnServer")
|
self.log = logging.getLogger("ConnServer")
|
||||||
self.port_opened = {}
|
self.port_opened = {}
|
||||||
self.peer_blacklist = SiteManager.peer_blacklist
|
self.peer_blacklist = SiteManager.peer_blacklist
|
||||||
|
@ -155,6 +156,9 @@ class ConnectionServer(object):
|
||||||
|
|
||||||
connection = Connection(self, ip, port, sock)
|
connection = Connection(self, ip, port, sock)
|
||||||
self.connections.append(connection)
|
self.connections.append(connection)
|
||||||
|
rev = connection.handshake.get("rev", 0)
|
||||||
|
if rev > 0 and rev == config.rev:
|
||||||
|
self.last_connection_id_current_version += 1
|
||||||
if ip not in config.ip_local:
|
if ip not in config.ip_local:
|
||||||
self.ips[ip] = connection
|
self.ips[ip] = connection
|
||||||
connection.handleIncomingConnection(sock)
|
connection.handleIncomingConnection(sock)
|
||||||
|
@ -219,6 +223,10 @@ class ConnectionServer(object):
|
||||||
if not succ:
|
if not succ:
|
||||||
connection.close("Connection event return error")
|
connection.close("Connection event return error")
|
||||||
raise Exception("Connection event return error")
|
raise Exception("Connection event return error")
|
||||||
|
else:
|
||||||
|
rev = connection.handshake.get("rev", 0)
|
||||||
|
if rev > 0 and rev == config.rev:
|
||||||
|
self.last_connection_id_current_version += 1
|
||||||
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
connection.close("%s Connect error: %s" % (ip, Debug.formatException(err)))
|
connection.close("%s Connect error: %s" % (ip, Debug.formatException(err)))
|
||||||
|
|
Loading…
Reference in a new issue