Cross-protocol Firewall kill made easier to access
This commit is contained in:
parent
4afbcd02a7
commit
71e7dc5cb1
1 changed files with 25 additions and 1 deletions
|
|
@ -1,3 +1,6 @@
|
|||
from core.controllers.SystemStateController import SystemStateController
|
||||
from core.services.networking.systemwide.systemwide_wireguard import terminate_system_connection
|
||||
from core.services.networking.systemwide.encrypted_proxy.singbox_runner import end_singbox
|
||||
from core.controllers.SessionStateController import SessionStateController
|
||||
from core.models.Result import Result, ResultError
|
||||
from core.errors.logger import logger
|
||||
|
|
@ -14,3 +17,24 @@ def kill_profile_from_grave(profile_id: int) -> Result:
|
|||
error_msg = "Even psutil scortched earth failed to kill the profile."
|
||||
logger.error(error_msg)
|
||||
return Result(valid=False, error_type=ResultError.STATE, message=error_msg)
|
||||
|
||||
|
||||
def kill_everything():
|
||||
"""End all systemwide protocols immediately."""
|
||||
|
||||
# this notifies UI:
|
||||
SystemStateController.dissolve()
|
||||
|
||||
# Then raw repeat it:
|
||||
try:
|
||||
# Wireguard
|
||||
terminate_system_connection(
|
||||
firewall_setting=True,
|
||||
dns_setting=True
|
||||
)
|
||||
|
||||
# singbox:
|
||||
end_singbox()
|
||||
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
Loading…
Reference in a new issue