Added Custom Openssl Path for Native Clients
This Parameter helpful where openssl path is not fixed always, we can also use this to reduce code verbosity by providing other like these and provide them as parameter ``` if sys.platform.startswith("win"): self.openssl_bin = "tools\\openssl\\openssl.exe" elif config.dist_type.startswith("bundle_linux"): self.openssl_bin = "../runtime/bin/openssl" else: self.openssl_bin = "openssl" ``` Also Fixed Tracker files provided are not loading on some systems like Android client where path storage access is restricted
This commit is contained in:
parent
28ce08de8e
commit
c553c2bd35
2 changed files with 16 additions and 6 deletions
|
@ -31,6 +31,7 @@ class Config(object):
|
||||||
|
|
||||||
self.config_file = self.start_dir + "/zeronet.conf"
|
self.config_file = self.start_dir + "/zeronet.conf"
|
||||||
self.data_dir = self.start_dir + "/data"
|
self.data_dir = self.start_dir + "/data"
|
||||||
|
self.openssl_path = "default"
|
||||||
self.log_dir = self.start_dir + "/log"
|
self.log_dir = self.start_dir + "/log"
|
||||||
|
|
||||||
self.trackers_file = False
|
self.trackers_file = False
|
||||||
|
@ -108,6 +109,7 @@ class Config(object):
|
||||||
|
|
||||||
config_file = self.start_dir + "/zeronet.conf"
|
config_file = self.start_dir + "/zeronet.conf"
|
||||||
data_dir = self.start_dir + "/data"
|
data_dir = self.start_dir + "/data"
|
||||||
|
openssl_path = "default"
|
||||||
log_dir = self.start_dir + "/log"
|
log_dir = self.start_dir + "/log"
|
||||||
|
|
||||||
ip_local = ["127.0.0.1", "::1"]
|
ip_local = ["127.0.0.1", "::1"]
|
||||||
|
@ -259,6 +261,7 @@ class Config(object):
|
||||||
self.parser.add_argument('--ip_external', help='Set reported external ip (tested on start if None)', metavar='ip', nargs='*')
|
self.parser.add_argument('--ip_external', help='Set reported external ip (tested on start if None)', metavar='ip', nargs='*')
|
||||||
self.parser.add_argument('--offline', help='Disable network communication', action='store_true')
|
self.parser.add_argument('--offline', help='Disable network communication', action='store_true')
|
||||||
|
|
||||||
|
self.parser.add_argument('--openssl_path', help='Custom Path to OpenSSL Binary', default=openssl_path, metavar="path")
|
||||||
self.parser.add_argument('--disable_udp', help='Disable UDP connections', action='store_true')
|
self.parser.add_argument('--disable_udp', help='Disable UDP connections', action='store_true')
|
||||||
self.parser.add_argument('--proxy', help='Socks proxy address', metavar='ip:port')
|
self.parser.add_argument('--proxy', help='Socks proxy address', metavar='ip:port')
|
||||||
self.parser.add_argument('--bind', help='Bind outgoing sockets to this address', metavar='ip')
|
self.parser.add_argument('--bind', help='Bind outgoing sockets to this address', metavar='ip')
|
||||||
|
@ -321,6 +324,9 @@ class Config(object):
|
||||||
trackers_file_path = trackers_file
|
trackers_file_path = trackers_file
|
||||||
elif trackers_file.startswith("{data_dir}"): # Relative to data_dir
|
elif trackers_file.startswith("{data_dir}"): # Relative to data_dir
|
||||||
trackers_file_path = trackers_file.replace("{data_dir}", self.data_dir)
|
trackers_file_path = trackers_file.replace("{data_dir}", self.data_dir)
|
||||||
|
elif trackers_file.startswith("data/"):
|
||||||
|
# Relative to data_dir Useful for Unix Type Systems and Android Clients
|
||||||
|
trackers_file_path = trackers_file.replace("data", self.data_dir)
|
||||||
else: # Relative to zeronet.py
|
else: # Relative to zeronet.py
|
||||||
trackers_file_path = self.start_dir + "/" + trackers_file
|
trackers_file_path = self.start_dir + "/" + trackers_file
|
||||||
|
|
||||||
|
@ -479,7 +485,7 @@ class Config(object):
|
||||||
for key, val in args.items():
|
for key, val in args.items():
|
||||||
if type(val) is list:
|
if type(val) is list:
|
||||||
val = val[:]
|
val = val[:]
|
||||||
if key in ("data_dir", "log_dir"):
|
if key in ("data_dir", "log_dir", "openssl_path"):
|
||||||
val = val.replace("\\", "/")
|
val = val.replace("\\", "/")
|
||||||
setattr(self, key, val)
|
setattr(self, key, val)
|
||||||
|
|
||||||
|
@ -563,6 +569,7 @@ class Config(object):
|
||||||
|
|
||||||
"log_dir": os.path.abspath(self.log_dir),
|
"log_dir": os.path.abspath(self.log_dir),
|
||||||
"data_dir": os.path.abspath(self.data_dir),
|
"data_dir": os.path.abspath(self.data_dir),
|
||||||
|
"openssl_path": os.path.abspath(self.openssl_path),
|
||||||
"src_dir": os.path.dirname(os.path.abspath(__file__))
|
"src_dir": os.path.dirname(os.path.abspath(__file__))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,9 @@ from util import helper
|
||||||
|
|
||||||
class CryptConnectionManager:
|
class CryptConnectionManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
if config.openssl_path != "default":
|
||||||
|
self.openssl_bin = config.openssl_path
|
||||||
|
else:
|
||||||
if sys.platform.startswith("win"):
|
if sys.platform.startswith("win"):
|
||||||
self.openssl_bin = "tools\\openssl\\openssl.exe"
|
self.openssl_bin = "tools\\openssl\\openssl.exe"
|
||||||
elif config.dist_type.startswith("bundle_linux"):
|
elif config.dist_type.startswith("bundle_linux"):
|
||||||
|
|
Loading…
Reference in a new issue