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

Add WireGuard NetP Error Pixels #2023

Merged
merged 13 commits into from
Sep 21, 2023
Merged
1 change: 1 addition & 0 deletions Core/Pixel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public struct PixelParameters {
// Network Protection
public static let keychainFieldName = "fieldName"
public static let keychainErrorCode = errorCode
public static let wireguardErrorCode = errorCode
public static let function = "function"
public static let line = "line"
public static let reason = "reason"
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8893,8 +8893,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 78.2.2;
kind = revision;
revision = c7e614d92877866029a0ed057f5ba7aac99ce240;
};
};
C14882EB27F211A000D59F0C /* XCRemoteSwiftPackageReference "SwiftSoup" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"repositoryURL": "https://github.com/DuckDuckGo/BrowserServicesKit",
"state": {
"branch": null,
"revision": "781e68decc81dc33a6a7593ab88b1e074a8ee051",
"version": "78.2.2"
"revision": "c7e614d92877866029a0ed057f5ba7aac99ce240",
"version": null
}
},
{
Expand Down
11 changes: 7 additions & 4 deletions DuckDuckGo/EventMapping+NetworkProtectionError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,19 @@ extension EventMapping where Event == NetworkProtectionError {
.failedToDecodeServerList,
.failedToWriteServerList,
.couldNotCreateServerListDirectory,
.failedToReadServerList:
.failedToReadServerList,
.wireGuardCannotLocateTunnelFileDescriptor,
.wireGuardInvalidState,
.wireGuardDnsResolution,
.wireGuardSetNetworkSettings,
.startWireGuardBackend:
pixelEvent = .networkProtectionUnhandledError
params[PixelParameters.function] = #function
params[PixelParameters.line] = String(#line)
// Should never be sent from from the app
case .unhandledError(function: let function, line: let line, error: let error):
pixelEvent = .networkProtectionUnhandledError
params[PixelParameters.function] = function
params[PixelParameters.line] = String(line)
pixelError = error

}

DailyPixel.fireDailyAndCount(pixel: pixelEvent, error: pixelError, withAdditionalParameters: params)
Expand Down
12 changes: 12 additions & 0 deletions PacketTunnelProvider/NetworkProtectionPacketTunnelProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ final class NetworkProtectionPacketTunnelProvider: PacketTunnelProvider {
case .keychainDeleteError(let status): // TODO: Check whether field needed here
pixelEvent = .networkProtectionKeychainDeleteError
params[PixelParameters.keychainErrorCode] = String(status)
case .wireGuardCannotLocateTunnelFileDescriptor:
pixelEvent = .networkProtectionWireguardErrorCannotLocateTunnelFileDescriptor
case .wireGuardInvalidState:
pixelEvent = .networkProtectionWireguardErrorInvalidState
case .wireGuardDnsResolution:
pixelEvent = .networkProtectionWireguardErrorFailedDNSResolution
case .wireGuardSetNetworkSettings(let error):
pixelEvent = .networkProtectionWireguardErrorCannotSetNetworkSettings
pixelError = error
case .startWireGuardBackend(let code):
pixelEvent = .networkProtectionWireguardErrorCannotStartWireguardBackend
params[PixelParameters.wireguardErrorCode] = String(code)
case .noAuthTokenFound:
pixelEvent = .networkProtectionNoAuthTokenFoundError
case .unhandledError(function: let function, line: let line, error: let error):
Expand Down