Skip to content

Commit

Permalink
Clean up VPN code.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsymons committed Oct 30, 2024
1 parent b226f66 commit 50ebfc7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 53 deletions.
4 changes: 2 additions & 2 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14675,8 +14675,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/duckduckgo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 201.0.0;
branch = "sam/vpn-clean-up";
kind = branch;
};
};
9FF521422BAA8FF300B9819B /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "e5946eee6af859690cc1cc5e51daef3c8368981b",
"version" : "201.0.0"
"branch" : "sam/vpn-clean-up",
"revision" : "70cbb192aa421e316962c12401fb78bfc714b1a9"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
case networkProtectionClientFailedToEncodeRegisterKeyRequest
case networkProtectionClientFailedToFetchRegisteredServers(_ error: Error?)
case networkProtectionClientFailedToParseRegisteredServersResponse
case networkProtectionClientFailedToEncodeRedeemRequest
case networkProtectionClientInvalidInviteCode
case networkProtectionClientFailedToRedeemInviteCode(_ error: Error?)
case networkProtectionClientFailedToParseRedeemResponse(_ error: Error)
case networkProtectionClientFailedToFetchLocations(_ error: Error?)
case networkProtectionClientFailedToParseLocationsResponse(_ error: Error?)
case networkProtectionClientFailedToFetchServerStatus(_ error: Error?)
Expand Down Expand Up @@ -246,18 +242,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
case .networkProtectionClientFailedToParseRegisteredServersResponse:
return "netp_backend_api_error_parsing_device_registration_response_failed"

case .networkProtectionClientFailedToEncodeRedeemRequest:
return "netp_backend_api_error_encoding_redeem_request_body_failed"

case .networkProtectionClientInvalidInviteCode:
return "netp_backend_api_error_invalid_invite_code"

case .networkProtectionClientFailedToRedeemInviteCode:
return "netp_backend_api_error_failed_to_redeem_invite_code"

case .networkProtectionClientFailedToParseRedeemResponse:
return "netp_backend_api_error_parsing_redeem_response_failed"

case .networkProtectionClientFailedToFetchLocations:
return "netp_backend_api_error_failed_to_fetch_location_list"

Expand Down Expand Up @@ -387,8 +371,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
return error?.pixelParameters
case .networkProtectionClientFailedToFetchRegisteredServers(let error):
return error?.pixelParameters
case .networkProtectionClientFailedToRedeemInviteCode(let error):
return error?.pixelParameters
case .networkProtectionClientFailedToFetchLocations(let error):
return error?.pixelParameters
case .networkProtectionClientFailedToParseLocationsResponse(let error):
Expand Down Expand Up @@ -450,9 +432,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionClientFailedToParseServerListResponse,
.networkProtectionClientFailedToEncodeRegisterKeyRequest,
.networkProtectionClientFailedToParseRegisteredServersResponse,
.networkProtectionClientFailedToEncodeRedeemRequest,
.networkProtectionClientInvalidInviteCode,
.networkProtectionClientFailedToParseRedeemResponse,
.networkProtectionClientInvalidAuthToken,
.networkProtectionWireguardErrorCannotLocateTunnelFileDescriptor,
.networkProtectionWireguardErrorFailedDNSResolution,
Expand All @@ -473,8 +452,7 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {

var error: (any Error)? {
switch self {
case .networkProtectionClientFailedToRedeemInviteCode(let error),
.networkProtectionClientFailedToFetchLocations(let error),
case .networkProtectionClientFailedToFetchLocations(let error),
.networkProtectionClientFailedToParseLocationsResponse(let error),
.networkProtectionClientFailedToFetchServerList(let error),
.networkProtectionClientFailedToFetchRegisteredServers(let error),
Expand All @@ -486,7 +464,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionTunnelStopFailure(let error),
.networkProtectionTunnelUpdateFailure(let error),
.networkProtectionTunnelWakeFailure(let error),
.networkProtectionClientFailedToParseRedeemResponse(let error),
.networkProtectionWireguardErrorCannotSetNetworkSettings(let error),
.networkProtectionWireguardErrorCannotStartWireguardBackend(let error),
.networkProtectionWireguardErrorCannotSetWireguardConfig(let error),
Expand Down Expand Up @@ -530,8 +507,6 @@ enum NetworkProtectionPixelEvent: PixelKitEventV2 {
.networkProtectionClientFailedToParseServerListResponse,
.networkProtectionClientFailedToEncodeRegisterKeyRequest,
.networkProtectionClientFailedToParseRegisteredServersResponse,
.networkProtectionClientFailedToEncodeRedeemRequest,
.networkProtectionClientInvalidInviteCode,
.networkProtectionClientInvalidAuthToken,
.networkProtectionKeychainErrorFailedToCastKeychainValueToData,
.networkProtectionKeychainReadError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ extension EventMapping where Event == NetworkProtectionError {
let frequency: PixelKit.Frequency

switch event {
case .failedToEncodeRedeemRequest:
domainEvent = .networkProtectionClientFailedToEncodeRedeemRequest
frequency = .standard
case .invalidInviteCode:
domainEvent = .networkProtectionClientInvalidInviteCode
frequency = .standard
case .failedToRedeemInviteCode(let error):
domainEvent = .networkProtectionClientFailedToRedeemInviteCode(error)
frequency = .standard
case .failedToParseRedeemResponse(let error):
domainEvent = .networkProtectionClientFailedToParseRedeemResponse(error)
frequency = .standard
case .invalidAuthToken:
domainEvent = .networkProtectionClientInvalidAuthToken
frequency = .standard
Expand Down Expand Up @@ -83,7 +71,6 @@ extension EventMapping where Event == NetworkProtectionError {
.wireGuardSetNetworkSettings,
.startWireGuardBackend,
.setWireguardConfig,
.failedToRetrieveAuthToken,
.failedToFetchServerStatus,
.failedToParseServerStatusResponse:
domainEvent = .networkProtectionUnhandledError(function: #function, line: #line, error: event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ final class MacPacketTunnelProvider: PacketTunnelProvider {
domainEvent = .networkProtectionClientFailedToFetchRegisteredServers(eventError)
case .failedToParseRegisteredServersResponse:
domainEvent = .networkProtectionClientFailedToParseRegisteredServersResponse
case .failedToEncodeRedeemRequest:
domainEvent = .networkProtectionClientFailedToEncodeRedeemRequest
case .invalidInviteCode:
domainEvent = .networkProtectionClientInvalidInviteCode
case .failedToRedeemInviteCode(let error):
domainEvent = .networkProtectionClientFailedToRedeemInviteCode(error)
case .failedToParseRedeemResponse(let error):
domainEvent = .networkProtectionClientFailedToParseRedeemResponse(error)
case .invalidAuthToken:
domainEvent = .networkProtectionClientInvalidAuthToken
case .serverListInconsistency:
Expand Down Expand Up @@ -124,8 +116,7 @@ final class MacPacketTunnelProvider: PacketTunnelProvider {
domainEvent = .networkProtectionClientFailedToParseServerStatusResponse(error)
case .unhandledError(function: let function, line: let line, error: let error):
domainEvent = .networkProtectionUnhandledError(function: function, line: line, error: error)
case .failedToRetrieveAuthToken,
.failedToFetchLocationList,
case .failedToFetchLocationList,
.failedToParseLocationListResponse:
// Needs Privacy triage for macOS Geoswitching pixels
return
Expand Down

0 comments on commit 50ebfc7

Please sign in to comment.