-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Pass block_untunneled_traffic flag throughh to WireGuard service #39405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,6 +178,16 @@ void BraveVPNConnectionManager::SetSelectedRegion(const std::string& name) { | |
| } | ||
| } | ||
|
|
||
| bool BraveVPNConnectionManager::ShouldBlockUntunneledTraffic() { | ||
| #if BUILDFLAG(ENABLE_BRAVE_VPN_WIREGUARD) | ||
| return local_prefs_->GetBoolean( | ||
| prefs::kBraveVPNWireguardBlockUntunneledTraffic) && | ||
| local_prefs_->GetBoolean(prefs::kBraveVPNWireguardEnabled); | ||
| #else | ||
| NOTREACHED(); | ||
| #endif | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: this new guard spans more than 3 lines and has an |
||
| } | ||
|
|
||
| std::string BraveVPNConnectionManager::GetHostname() const { | ||
| if (connection_api_impl_) { | ||
| return connection_api_impl_->GetHostname(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,6 +82,7 @@ class BraveVPNConnectionManager { | |
| void CheckConnection(); | ||
|
|
||
| void SetSelectedRegion(const std::string& name); | ||
| bool ShouldBlockUntunneledTraffic(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: worth a one-line comment on this new public method — the implementation |
||
|
|
||
| // Returns user friendly error string if existed. | ||
| // Otherwise returns empty. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,7 +60,8 @@ std::optional<std::string> CreateWireguardConfig( | |
| const std::string& client_private_key, | ||
| const std::string& server_public_key, | ||
| const std::string& vpn_server_hostname, | ||
| const std::string& mapped_ipv4_address) { | ||
| const std::string& mapped_ipv4_address, | ||
| const bool block_untunneled_traffic) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if (client_private_key.empty() || server_public_key.empty() || | ||
| vpn_server_hostname.empty() || mapped_ipv4_address.empty()) { | ||
| return std::nullopt; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
NOTREACHED()is defined inbase/notreached.h, which this file doesn't include (onlybase/check.h/base/logging.hare). Please add the include rather than relying on a transitive one. (✅ Always Include What You Use (IWYU))