Add support for WireGuard endpoint verification

This commit is contained in:
codeking 2025-11-05 02:25:57 +01:00
parent 5080014070
commit f95c4cf8d2

View file

@ -1,5 +1,5 @@
from core.Constants import Constants
from core.Errors import MissingSubscriptionError, InvalidSubscriptionError, UnknownConnectionTypeError, ConnectionUnprotectedError, ProfileStateConflictError
from core.Errors import MissingSubscriptionError, InvalidSubscriptionError, UnknownConnectionTypeError, ConnectionUnprotectedError, EndpointVerificationError, ProfileStateConflictError
from core.controllers.ApplicationController import ApplicationController
from core.controllers.ApplicationVersionController import ApplicationVersionController
from core.controllers.ClientController import ClientController
@ -95,9 +95,14 @@ if __name__ == '__main__':
pristine_parser = argparse.ArgumentParser(add_help=False)
pristine_parser.add_argument('--pristine', '-p', action='store_true')
security_parser = argparse.ArgumentParser(add_help=False)
security_parser.add_argument('--disable-connection-protection', action='store_true')
security_parser.add_argument('--disable-profile-state-protection', action='store_true')
connection_protection_parser = argparse.ArgumentParser(add_help=False)
connection_protection_parser.add_argument('--without-connection-protection', action='store_true')
endpoint_verification_parser = argparse.ArgumentParser(add_help=False)
endpoint_verification_parser.add_argument('--without-endpoint-verification', action='store_true')
profile_state_protection_parser = argparse.ArgumentParser(add_help=False)
profile_state_protection_parser.add_argument('--without-profile-state-protection', action='store_true')
main_parser = argparse.ArgumentParser(prog=__get_name())
main_parser.add_argument('--version', '-v', action='version', version=f'{__get_name()} v{__get_version()}')
@ -133,8 +138,8 @@ if __name__ == '__main__':
profile_subparsers.add_parser('destroy', parents=[profile_base_parser])
profile_subparsers.add_parser('enable', parents=[profile_base_parser, pristine_parser, security_parser])
profile_subparsers.add_parser('disable', parents=[profile_base_parser, security_parser])
profile_subparsers.add_parser('enable', parents=[profile_base_parser, pristine_parser, connection_protection_parser, endpoint_verification_parser, profile_state_protection_parser])
profile_subparsers.add_parser('disable', parents=[profile_base_parser, connection_protection_parser])
application_parser = main_subparsers.add_parser('application')
application_subparsers = application_parser.add_subparsers(title='subcommands', dest='subcommand')
@ -171,10 +176,13 @@ if __name__ == '__main__':
ignore = []
if getattr(arguments, 'disable_connection_protection', False):
if getattr(arguments, 'without_connection_protection', False):
ignore.append(ConnectionUnprotectedError)
if getattr(arguments, 'disable_profile_state_protection', False):
if getattr(arguments, 'without_endpoint_verification', False):
ignore.append(EndpointVerificationError)
if getattr(arguments, 'without_profile_state_protection', False):
ignore.append(ProfileStateConflictError)
ignore = tuple(ignore)