Skip to content
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

VPN now recovers from WireGuard closing utun #3084

Merged
merged 9 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13464,8 +13464,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 183.0.0;
kind = revision;
revision = c538181b02990b2862c80684f297c183bf74b934;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "c3ae1865ba36ebbcb5451a836424213ea875d135",
"version" : "183.0.0"
"revision" : "c538181b02990b2862c80684f297c183bf74b934"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
case networkProtectionWireguardErrorInvalidState(reason: String)
case networkProtectionWireguardErrorFailedDNSResolution
case networkProtectionWireguardErrorCannotSetNetworkSettings(_ error: Error)
case networkProtectionWireguardErrorCannotStartWireguardBackend(code: Int32)
case networkProtectionWireguardErrorCannotStartWireguardBackend(_ error: Error)
case networkProtectionWireguardErrorCannotSetWireguardConfig(_ error: Error)

case networkProtectionNoAuthTokenFoundError

Expand Down Expand Up @@ -290,6 +291,9 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
case .networkProtectionWireguardErrorCannotStartWireguardBackend:
return "netp_wireguard_error_cannot_start_wireguard_backend"

case .networkProtectionWireguardErrorCannotSetWireguardConfig:
return "netp_wireguard_error_cannot_set_wireguard_config"

case .networkProtectionNoAuthTokenFoundError:
return "netp_no_auth_token_found_error"

Expand Down Expand Up @@ -378,8 +382,10 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
return parameters
case .networkProtectionWireguardErrorCannotSetNetworkSettings(let error):
return error.pixelParameters
case .networkProtectionWireguardErrorCannotStartWireguardBackend(code: let code):
return [PixelKit.Parameters.errorCode: String(code)]
case .networkProtectionWireguardErrorCannotStartWireguardBackend(let error):
return error.pixelParameters
case .networkProtectionWireguardErrorCannotSetWireguardConfig(let error):
return error.pixelParameters
case .networkProtectionClientFailedToFetchServerStatus(let error):
return error?.pixelParameters
case .networkProtectionClientFailedToParseServerStatusResponse(let error):
Expand Down Expand Up @@ -458,6 +464,8 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionTunnelWakeFailure(let error),
.networkProtectionClientFailedToParseRedeemResponse(let error),
.networkProtectionWireguardErrorCannotSetNetworkSettings(let error),
.networkProtectionWireguardErrorCannotStartWireguardBackend(let error),
.networkProtectionWireguardErrorCannotSetWireguardConfig(let error),
.networkProtectionRekeyFailure(let error),
.networkProtectionUnhandledError(_, _, let error),
.networkProtectionSystemExtensionActivationFailure(let error),
Expand Down Expand Up @@ -507,7 +515,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionWireguardErrorCannotLocateTunnelFileDescriptor,
.networkProtectionWireguardErrorInvalidState,
.networkProtectionWireguardErrorFailedDNSResolution,
.networkProtectionWireguardErrorCannotStartWireguardBackend,
.networkProtectionNoAuthTokenFoundError,
.networkProtectionRekeyAttempt,
.networkProtectionRekeyCompleted,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ extension EventMapping where Event == NetworkProtectionError {
.wireGuardDnsResolution,
.wireGuardSetNetworkSettings,
.startWireGuardBackend,
.setWireguardConfig,
.failedToRetrieveAuthToken,
.failedToFetchServerStatus,
.failedToParseServerStatusResponse:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ final class MacPacketTunnelProvider: PacketTunnelProvider {
domainEvent = .networkProtectionWireguardErrorFailedDNSResolution
case .wireGuardSetNetworkSettings(let error):
domainEvent = .networkProtectionWireguardErrorCannotSetNetworkSettings(error)
case .startWireGuardBackend(let code):
domainEvent = .networkProtectionWireguardErrorCannotStartWireguardBackend(code: code)
case .startWireGuardBackend(let error):
domainEvent = .networkProtectionWireguardErrorCannotStartWireguardBackend(error)
case .setWireguardConfig(let error):
domainEvent = .networkProtectionWireguardErrorCannotSetWireguardConfig(error)
case .noAuthTokenFound:
domainEvent = .networkProtectionNoAuthTokenFoundError
case .failedToFetchServerStatus(let error):
Expand Down
14 changes: 10 additions & 4 deletions UnitTests/NetworkProtection/NetworkProtectionPixelEventTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,18 @@ final class NetworkProtectionPixelEventTests: XCTestCase {
underlyingErrors: [TestError.underlyingError]),
file: #filePath,
line: #line)
fire(NetworkProtectionPixelEvent.networkProtectionWireguardErrorCannotStartWireguardBackend(code: 1),
fire(NetworkProtectionPixelEvent.networkProtectionWireguardErrorCannotStartWireguardBackend(TestError.testError),
frequency: .dailyAndCount,
and: .expect(pixelName: "m_mac_netp_wireguard_error_cannot_start_wireguard_backend",
customFields: [
PixelKit.Parameters.errorCode: "1"
]),
error: TestError.testError,
underlyingErrors: [TestError.underlyingError]),
file: #filePath,
line: #line)
fire(NetworkProtectionPixelEvent.networkProtectionWireguardErrorCannotSetWireguardConfig(TestError.testError),
frequency: .dailyAndCount,
and: .expect(pixelName: "m_mac_netp_wireguard_error_cannot_set_wireguard_config",
error: TestError.testError,
underlyingErrors: [TestError.underlyingError]),
file: #filePath,
line: #line)
fire(NetworkProtectionPixelEvent.networkProtectionNoAuthTokenFoundError,
Expand Down