diff --git a/arch/PKGBUILD b/arch/PKGBUILD index 898fed1..3a5a452 100644 --- a/arch/PKGBUILD +++ b/arch/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Proton Technologies AG pkgname=protonvpn-cli pkgver=3.11.1 -pkgrel=1 +pkgrel=2 pkgdesc="Official ProtonVPN CLI." arch=("any") url="https://github.com/ProtonVPN/" diff --git a/debian/changelog b/debian/changelog index 75ee84c..8b80f40 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ -protonvpn-cli (3.11.1-1) unstable; urgency=medium +protonvpn-cli (3.11.1-2) unstable; urgency=medium - * Bug: Display message when incorrectly formatted servername is provided + * Bugfix: Display message when incorrectly formatted servername is provided + * Feature: Modereate NAT -- Proton Technologies AG Thu, 16 Dez 2021 09:00:00 +0000 diff --git a/protonvpn_cli/cli.py b/protonvpn_cli/cli.py index 5ce12ae..5ede0a5 100644 --- a/protonvpn_cli/cli.py +++ b/protonvpn_cli/cli.py @@ -336,6 +336,15 @@ def custom_dns(): "disable", ] ) + group.add_argument( + "--moderate-nat", + help="Moderate NAT.", + nargs=1, + choices=[ + "enable", + "disable", + ] + ) group.add_argument( "-d", "--default", help="Reset do default configurations.", @@ -361,24 +370,19 @@ def custom_dns(): and not args.list and not args.vpn_accelerator and not args.alt_routing + and not args.moderate_nat ) ): print(CONFIG_HELP) return 0 elif ( - ( - not args.protocol - and not args.default - and not args.alt_routing - and not args.vpn_accelerator - and not args.help - ) or ( - not args.protocol - and not args.vpn_accelerator - and not args.alt_routing - and not args.default - and args.help - ) + not args.protocol + and not args.default + and not args.alt_routing + and not args.vpn_accelerator + and not args.moderate_nat + and not args.help + ) and args.dns and args.dns.pop() == "custom": return custom_dns() diff --git a/protonvpn_cli/cli_wrapper.py b/protonvpn_cli/cli_wrapper.py index 0baa768..7959dc7 100644 --- a/protonvpn_cli/cli_wrapper.py +++ b/protonvpn_cli/cli_wrapper.py @@ -147,6 +147,26 @@ def set_alternative_routing(self, status): print("\nAlternative Routing has been {}d. ".format(status)) return 0 + def set_moderate_nat(self, status): + _status = { + "enable": UserSettingStatusEnum.ENABLED, + "disable": UserSettingStatusEnum.DISABLED + } + + try: + self.user_settings.moderate_nat = _status[status] + except KeyError as e: + logger.exception(e) + print("\nInvalid option was provided") + return 1 + except Exception as e: + logger.exception(e) + print(e) + return 1 + + print("\nModerate NAT has been {}d. ".format(status)) + return 0 + def logout(self): """Proxymethod to logout user.""" if not self.protonvpn.check_session_exists(): @@ -481,10 +501,9 @@ def set_netshield(self, args): print("\nPlease login to to be able to set NetShield.") return 1 - # To-do: Once infra is updated, implement this check - # if not self.protonvpn.get_session().clientconfig.features.netshield: - # print("\nThis feature is currently not supported.") - # return + if not self.protonvpn.get_session().clientconfig.features.netshield: + print("\nThis feature is currently not supported.") + return session = self.protonvpn.get_session() if not args.off and session.vpn_tier == ServerTierEnum.FREE.value: @@ -540,6 +559,7 @@ def configurations_menu(self, args): list=self.list_configurations, vpn_accelerator=self.set_vpn_accelerator, alt_routing=self.set_alternative_routing, + moderate_nat=self.set_moderate_nat, default=self.restore_default_configurations, ) diff --git a/protonvpn_cli/constants.py b/protonvpn_cli/constants.py index c842960..ddf1e25 100644 --- a/protonvpn_cli/constants.py +++ b/protonvpn_cli/constants.py @@ -96,6 +96,8 @@ -p, --protocol Change default protocol. -d, --default Reset to default configurations. --alt-routing Change alternative routing preference. + --moderate-nat Change Moderate NAT preference. + If disabled then strict NAT is applied. --vpn-accelerator VPN Accelerator enables a set of unique performance enhancing technologies which can increase VPN speeds by up to 400%. -h, --help Display help message. @@ -108,6 +110,7 @@ protonvpn-cli config --protocol udp protonvpn-cli config --vpn-accelerator enable protonvpn-cli config --alt-routing enable + protonvpn-cli config --moderate-nat disable protonvpn-cli config (-d | --default) protonvpn-cli config --help """ # noqa diff --git a/rpmbuild/SPECS/protonvpn-cli.spec b/rpmbuild/SPECS/protonvpn-cli.spec index 3355c01..144ce42 100644 --- a/rpmbuild/SPECS/protonvpn-cli.spec +++ b/rpmbuild/SPECS/protonvpn-cli.spec @@ -1,6 +1,6 @@ %define unmangled_name protonvpn-cli %define version 3.11.1 -%define release 1 +%define release 2 Prefix: %{_prefix} @@ -46,8 +46,9 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) %changelog -* Thu Dez 16 2021 Proton Technologies AG 3.11.1-1 -- Bug: Display message when incorrectly formatted servername is provided +* Thu Dez 16 2021 Proton Technologies AG 3.11.1-2 +- Bugfix: Display message when incorrectly formatted servername is provided +- Feature: Modereate NAT * Thu Nov 12 2021 Proton Technologies AG 3.11.0-7 - Improve: Handle accounting use cases