-
Notifications
You must be signed in to change notification settings - Fork 12
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
macOS: VPN Metadata Improvements #2704
Conversation
import NetworkProtectionIPC | ||
|
||
@objc | ||
final class ErrorInformation: NSObject, Codable { |
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.
Privacy friendly error information for reports.
/// | ||
/// To be used in combination with ``VPNOperationErrorRecorder`` | ||
/// | ||
final class VPNOperationErrorHistory { |
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.
To query error history.
/// | ||
/// To be used in combination with ``VPNOperationErrorHistory`` | ||
/// | ||
final class VPNOperationErrorRecorder { |
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.
To store new error history.
@@ -222,7 +228,7 @@ final class DefaultVPNMetadataCollector: VPNMetadataCollector { | |||
func collectVPNState() async -> VPNMetadata.VPNState { | |||
let onboardingState: String | |||
|
|||
switch UserDefaults.netP.networkProtectionOnboardingStatus { |
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.
Just making the defaults injectable as we'll eventually want to test this class.
@@ -127,6 +127,19 @@ extension TunnelControllerIPCService: IPCServerInterface { | |||
completion(nil) | |||
} | |||
|
|||
func fetchLastError(completion: @escaping (Error?) -> Void) { | |||
Task { | |||
guard #available(macOS 13.0, *), |
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.
This is necessary because fetchLastDisconnectError
is not available before macOS 13.
I'm ok with not returning anything if this is not available, since I'm not sure we can properly return something that doesn't also introduce potential noise.
We can do follow-up work on this if necessary.
/// The earliest error is the one that best represents the latest failure | ||
/// | ||
var lastStartError: ErrorInformation? { | ||
lastIPCStartError ?? lastControllerStartError |
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.
By doing this, we try to make the metadata easier to parse. If there's an IPC error we should report that because it means we never got to the controller (and error information there may be from a previous attempt).
But if there was no IPC error, we should report the controller start error instead.
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.
Looks good. Thanks for the detailed test steps
Task/Issue URL: https://app.asana.com/0/0/1206897550778458/f iOS PR: duckduckgo/iOS#2791 macOS PR: duckduckgo/macos-browser#2704 What kind of version bump will this require?: Minor ## Description Adds some improved tracking of tunnel interfaces to include `ipsec` tunnels.
Task/Issue URL: https://app.asana.com/0/414235014887631/1207169059489741/f macOS: duckduckgo/macos-browser#2704 BSK: duckduckgo/BrowserServicesKit#799 ## Description Updates VPN feedback metadata to include `ipsec` tunnel count.
…utdown # By Dax the Duck (9) and others # Via GitHub (6) and others * main: (47 commits) Update BSK to 141.1.1 (#2713) macOS: VPN Metadata Improvements (#2704) duck page suggestions (#2666) macOS: Add pixels to track VPN wake and stop attempts (#2694) Trusted url indicator (#2665) remove Tab.TabContent.url (#2647) Bump version to 1.85.0 (176) Update release automation to support Privacy Pro section in release notes (#2710) Fix for VPN stop issues. (#2689) Hard-codes the VPN waitlist flags to ON (#2709) Add subscription status to the macOS metadata (#2680) Bump version to 1.85.0 (175) Call finish in the correct place (#2702) Fix layout issue on DBP (#2700) Update autoconsent to v10.6.1 (#2618) Make Clear All History shortcut available without entering Main Menu (#2682) Fix DataBrokerProtectionProcessor.swift lint Fix SwiftLint Add parameter allowed encoding to error descriptions (#2691) Remove debug flags ... # Conflicts: # DuckDuckGo.xcodeproj/project.pbxproj # DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Task/Issue URL: https://app.asana.com/0/0/1207169059489741/f
iOS: duckduckgo/iOS#2791
BSK: duckduckgo/BrowserServicesKit#799
Description
ipsec
tunnel count.lastExtensionVersionRun
to VPN metadata in the App Store buildTesting
Test 1: IPC Failure in metadata
NOTE: in this test there a UI issue where the toggle is not becoming disabled until you hide and show the VPN popover, but is unrelaed to my changes
launchctl remove <bundle_id>
Test 2: Controller Failure in metadata
NOTE: in this test there a UI issue where the toggle is not becoming disabled until you hide and show the VPN popover, but is unrelaed to my changes
StartError.noAuthToken
)Test 3: Tunnel Failure in metadata
NOTE: in this test there a UI issue where the toggle is not becoming disabled until you hide and show the VPN popover, but is unrelaed to my changes
Roll back the error we were force throwing in the previous test
Add the following method to
MacPacketTunnelProvider.swift
override func startTunnel(options: [String : NSObject]?, completionHandler: @escaping (Error?) -> Void) {
super.startTunnel(options: options, completionHandler: completionHandler)
}
Start the app
Try to start the VPN, it should fail
Wait at least 5 seconds
Print the metadata to console and ensure you see the IPC error in it (Error domain=test code=5)
Internal references:
Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation