-
Notifications
You must be signed in to change notification settings - Fork 10
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: Add pixels to track VPN wake and stop attempts #2694
Changes from 5 commits
293b68a
76abe80
87b51a3
620ad09
9174045
7402dca
707b4d4
2d401b2
c926d46
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
// | ||
|
||
import Combine | ||
import Common | ||
import Foundation | ||
import Subscription | ||
import NetworkProtection | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,6 +233,24 @@ final class MacPacketTunnelProvider: PacketTunnelProvider { | |
frequency: .dailyAndCount, | ||
includeAppVersionParameter: true) | ||
} | ||
case .tunnelStopAttempt(let step): | ||
switch step { | ||
case .begin: | ||
PixelKit.fire( | ||
NetworkProtectionPixelEvent.networkProtectionTunnelStopAttempt, | ||
frequency: .standard, | ||
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. Daily attempts are useless, unfortunately. |
||
includeAppVersionParameter: true) | ||
case .failure(let error): | ||
PixelKit.fire( | ||
NetworkProtectionPixelEvent.networkProtectionTunnelStopFailure(error), | ||
frequency: .dailyAndCount, | ||
includeAppVersionParameter: true) | ||
case .success: | ||
PixelKit.fire( | ||
NetworkProtectionPixelEvent.networkProtectionTunnelStopSuccess, | ||
frequency: .dailyAndCount, | ||
includeAppVersionParameter: true) | ||
} | ||
case .tunnelUpdateAttempt(let step): | ||
switch step { | ||
case .begin: | ||
|
@@ -251,6 +269,24 @@ final class MacPacketTunnelProvider: PacketTunnelProvider { | |
frequency: .dailyAndCount, | ||
includeAppVersionParameter: true) | ||
} | ||
case .tunnelWakeAttempt(let step): | ||
switch step { | ||
case .begin: | ||
PixelKit.fire( | ||
NetworkProtectionPixelEvent.networkProtectionTunnelWakeAttempt, | ||
frequency: .dailyAndCount, | ||
includeAppVersionParameter: true) | ||
case .failure(let error): | ||
PixelKit.fire( | ||
NetworkProtectionPixelEvent.networkProtectionTunnelWakeFailure(error), | ||
frequency: .dailyAndCount, | ||
includeAppVersionParameter: true) | ||
case .success: | ||
PixelKit.fire( | ||
NetworkProtectionPixelEvent.networkProtectionTunnelWakeSuccess, | ||
frequency: .dailyAndCount, | ||
includeAppVersionParameter: true) | ||
} | ||
} | ||
} | ||
|
||
|
@@ -421,30 +457,6 @@ final class MacPacketTunnelProvider: PacketTunnelProvider { | |
try? loadDefaultPixelHeaders(from: options) | ||
} | ||
|
||
// MARK: - Start/Stop Tunnel | ||
|
||
override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) { | ||
super.stopTunnel(with: reason) { | ||
Task { | ||
completionHandler() | ||
|
||
// From what I'm seeing in my tests the next call to start the tunnel is MUCH | ||
// less likely to fail if we force this extension to exit when the tunnel is killed. | ||
// | ||
// Ref: https://app.asana.com/0/72649045549333/1204668639086684/f | ||
// | ||
exit(EXIT_SUCCESS) | ||
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. I found that after our recent changes, stopping the VPN works best when this is removed. Sometimes it was taking a while to stop with this still here. I'll be testing this in macOS 11 on the intel mac mini shortly. |
||
} | ||
} | ||
} | ||
|
||
override func cancelTunnelWithError(_ error: Error?) { | ||
Task { | ||
super.cancelTunnelWithError(error) | ||
exit(EXIT_SUCCESS) | ||
} | ||
} | ||
|
||
// MARK: - Pixels | ||
|
||
private func setupPixels(defaultHeaders: [String: String] = [:]) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ import PixelKit | |
|
||
final class MacTransparentProxyProvider: TransparentProxyProvider { | ||
|
||
static var vpnProxyLogger = Logger(subsystem: OSLog.subsystem, category: "VPN Proxy") | ||
static var vpnProxyLogger = Logger(subsystem: Bundle.main.bundleIdentifier ?? "DuckDuckGo", category: "VPN Proxy") | ||
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. Just to avoid the dependency with |
||
|
||
private var cancellables = Set<AnyCancellable>() | ||
|
||
|
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.
We don't want Logging.swift in system extensions, so I removed it from our tunnel and proxy sysexes.