mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-06 13:58:01 +03:00
Add default tor relay establish timeout constant
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -35,6 +35,7 @@ from Furious.Utility.Constants import (
|
||||
APPLICATION_TUN_GATEWAY_ADDRESS,
|
||||
DEFAULT_TOR_HTTPS_PORT,
|
||||
DEFAULT_TOR_SOCKS_PORT,
|
||||
DEFAULT_TOR_RELAY_ESTABLISH_TIMEOUT,
|
||||
)
|
||||
from Furious.Utility.Utility import (
|
||||
Switch,
|
||||
@@ -935,13 +936,14 @@ class ConnectAction(Action):
|
||||
|
||||
try:
|
||||
timeout = 1000 * int(
|
||||
self.torRelayStorageObj.get('relayEstablishTimeout', 15)
|
||||
self.torRelayStorageObj.get(
|
||||
'relayEstablishTimeout', DEFAULT_TOR_RELAY_ESTABLISH_TIMEOUT
|
||||
)
|
||||
)
|
||||
except Exception:
|
||||
# Any non-exit exceptions
|
||||
|
||||
# 15s
|
||||
timeout = 1000 * 15
|
||||
timeout = 1000 * DEFAULT_TOR_RELAY_ESTABLISH_TIMEOUT
|
||||
|
||||
logger.info(f'{TorRelay.name()} bootstrap timeout is {timeout // 1000}s')
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
from Furious.Core.Core import Core
|
||||
from Furious.Utility.Constants import (
|
||||
APP,
|
||||
PLATFORM,
|
||||
DATA_DIR,
|
||||
DEFAULT_TOR_SOCKS_PORT,
|
||||
DEFAULT_TOR_HTTPS_PORT,
|
||||
@@ -54,13 +55,21 @@ class TorRelayStarter(AsyncSubprocessMessage):
|
||||
return APP().torRelaySettingsWidget.StorageObj
|
||||
|
||||
def launch(self, proxyServer):
|
||||
self.torRelay = subprocess.Popen(
|
||||
['tor', '-f', '-'],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
creationflags=subprocess.CREATE_NO_WINDOW,
|
||||
)
|
||||
if PLATFORM == 'Windows':
|
||||
self.torRelay = subprocess.Popen(
|
||||
['tor', '-f', '-'],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
creationflags=subprocess.CREATE_NO_WINDOW,
|
||||
)
|
||||
else:
|
||||
self.torRelay = subprocess.Popen(
|
||||
['tor', '-f', '-'],
|
||||
stdin=subprocess.PIPE,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
|
||||
torConfig = (
|
||||
f'SocksPort {self.torRelayStorageObj.get("socksTunnelPort", DEFAULT_TOR_SOCKS_PORT)}\n'
|
||||
|
||||
@@ -76,6 +76,8 @@ TOR_FAQ_LABEL = f'Tor FAQ: <a href=\"{TOR_FAQ_URL}\">{TOR_FAQ_URL}</a>'
|
||||
# Avoid standard Tor port in case of running Tor services
|
||||
DEFAULT_TOR_SOCKS_PORT = 9048
|
||||
DEFAULT_TOR_HTTPS_PORT = 9047
|
||||
# 20s
|
||||
DEFAULT_TOR_RELAY_ESTABLISH_TIMEOUT = 20
|
||||
|
||||
ADMINISTRATOR_NAME = 'Administrator' if PLATFORM == 'Windows' else 'root'
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ from Furious.Utility.Constants import (
|
||||
PLATFORM,
|
||||
DEFAULT_TOR_SOCKS_PORT,
|
||||
DEFAULT_TOR_HTTPS_PORT,
|
||||
DEFAULT_TOR_RELAY_ESTABLISH_TIMEOUT,
|
||||
)
|
||||
from Furious.Utility.Utility import (
|
||||
StateContext,
|
||||
@@ -215,7 +216,9 @@ class TorRelaySettingsWidget(Translatable, SupportConnectedCallback, QDialog):
|
||||
self.StorageObj.get('logLevel', 'notice')
|
||||
)
|
||||
self.torRelayTimeoutSpinBox.setValue(
|
||||
self.StorageObj.get('relayEstablishTimeout', 15)
|
||||
self.StorageObj.get(
|
||||
'relayEstablishTimeout', DEFAULT_TOR_RELAY_ESTABLISH_TIMEOUT
|
||||
)
|
||||
)
|
||||
|
||||
def closeEvent(self, event):
|
||||
|
||||
Reference in New Issue
Block a user