small fix
This commit is contained in:
parent
d6b122b975
commit
7dca2744ce
3 changed files with 3 additions and 3 deletions
|
|
@ -180,6 +180,7 @@ class WebServiceApiService:
|
||||||
data['operator'].get('domain'),
|
data['operator'].get('domain'),
|
||||||
data['operator'].get('hysteria2_host'),
|
data['operator'].get('hysteria2_host'),
|
||||||
data['operator'].get('vless_host'),
|
data['operator'].get('vless_host'),
|
||||||
|
data.get('server_ip'),
|
||||||
)
|
)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
|
||||||
|
|
@ -93,20 +93,17 @@ def enable_hysteria(username: str, password: str, server_host: str,
|
||||||
|
|
||||||
_connected = False
|
_connected = False
|
||||||
try:
|
try:
|
||||||
# Fase 1 — arrancar sing-box
|
|
||||||
runner.write_config(config_path, config)
|
runner.write_config(config_path, config)
|
||||||
if not runner.start(config_path):
|
if not runner.start(config_path):
|
||||||
if observer:
|
if observer:
|
||||||
observer.notify("error", "sing-box not active after start")
|
observer.notify("error", "sing-box not active after start")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Fase 2 — esperar a que tun aparezca
|
|
||||||
if not wait_for_tun(timeout=15.0):
|
if not wait_for_tun(timeout=15.0):
|
||||||
if observer:
|
if observer:
|
||||||
observer.notify("error", f"{Constants.SINGBOX_TUN_IF} did not appear after 15s")
|
observer.notify("error", f"{Constants.SINGBOX_TUN_IF} did not appear after 15s")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Fase 3 — armar kill switch ahora que la interfaz existe
|
|
||||||
if not killswitch.arm(server_ip, Constants.SINGBOX_TUN_IF):
|
if not killswitch.arm(server_ip, Constants.SINGBOX_TUN_IF):
|
||||||
if observer:
|
if observer:
|
||||||
observer.notify("error", "Failed to arm kill switch")
|
observer.notify("error", "Failed to arm kill switch")
|
||||||
|
|
@ -121,6 +118,7 @@ def enable_hysteria(username: str, password: str, server_host: str,
|
||||||
observer.notify("connected", {
|
observer.notify("connected", {
|
||||||
"tunnel_if": Constants.SINGBOX_TUN_IF,
|
"tunnel_if": Constants.SINGBOX_TUN_IF,
|
||||||
"socks5_port": socks5_port,
|
"socks5_port": socks5_port,
|
||||||
|
"server_ip": server_ip,
|
||||||
"dns_enabled": _C.HYSTERIA2_DNS_ENABLED,
|
"dns_enabled": _C.HYSTERIA2_DNS_ENABLED,
|
||||||
"dns_active": dns_ok,
|
"dns_active": dns_ok,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,7 @@ def enable_vless(vless_link: str, username: str, server_ip: str,
|
||||||
observer.notify("connected", {
|
observer.notify("connected", {
|
||||||
"tunnel_if": Constants.SINGBOX_TUN_IF,
|
"tunnel_if": Constants.SINGBOX_TUN_IF,
|
||||||
"socks5_port": socks5_port,
|
"socks5_port": socks5_port,
|
||||||
|
"server_ip": server_ip,
|
||||||
"dns_enabled": _C.VLESS_DNS_ENABLED,
|
"dns_enabled": _C.VLESS_DNS_ENABLED,
|
||||||
"dns_active": dns_ok,
|
"dns_active": dns_ok,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue