-
Notifications
You must be signed in to change notification settings - Fork 3
chore: run coder connect networking from launchdaemon #203
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
base: ethan/mandatory-helper
Are you sure you want to change the base?
chore: run coder connect networking from launchdaemon #203
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
49d5c99
to
72071e5
Compare
72071e5
to
c7dbde8
Compare
c7dbde8
to
ef8832a
Compare
1737580
to
16c716d
Compare
ef8832a
to
e32d7de
Compare
guard let proxy = conn.remoteObjectProxyWithErrorHandler({ err in | ||
self.logger.error("failed to connect to HelperXPC \(err.localizedDescription, privacy: .public)") | ||
continuation.resume(throwing: err) | ||
}) as? HelperAppXPCInterface else { | ||
self.logger.error("failed to get proxy for HelperXPC") | ||
continuation.resume(throwing: XPCError.wrongProxyType) | ||
return | ||
} | ||
proxy.ping { | ||
self.logger.info("Connected to Helper over XPC") | ||
continuation.resume() | ||
} |
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.
Important to note that I've refactored all the XPC connections to use this pattern. With this, you're guaranteed that either the the XPC reply will be run (proxy.ping { reply }
in this case) or the [...]WithErrorHandler
callback.
// /var/root/Downloads | ||
private let dest = FileManager.default.urls(for: .downloadsDirectory, in: .userDomainMask) |
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.
Temporary. I've put it in /var/root/Library/Application\ Support/com.coder.Coder-Desktop/
as part of the PR that downloads the slim binary.
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.
The XPC code seems a lot nicer but the type names and directions of the XPC types are hard to understand
eebf562
to
291e5a1
Compare
b0c196f
to
b81afc9
Compare
7b9491c
to
6a93fac
Compare
b81afc9
to
e96075e
Compare
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.
The class is called HelperXPCClient
, but you can't have multiple Swift files with the same name. So, I've prepended NE
, since this is the HelperXPCClient
that runs within the network extension.
6eeb8aa
to
c8ecda2
Compare
a4b58e5
to
bd905ae
Compare
c8ecda2
to
21a8db1
Compare
bd905ae
to
33931d6
Compare
21a8db1
to
f4ebbbf
Compare
33931d6
to
0999089
Compare
f4ebbbf
to
04dd34b
Compare
0999089
to
1453e77
Compare
04dd34b
to
1e9fe08
Compare
Continues to address #201.
This PR reworks all XPC connections, such that the networking code runs within the privileged helper, instead of the network extension.
The XPC interfaces are described in
XPC.swift
, and roughly follow this sequence diagram:(One difference is that we don't posix spawn the tunnel in this PR)
Of note is that the network extension starts and stops the daemon running within the privileged helper.
This is to support starting and stopping the VPN from the toggle in System Settings, and to ensure the "Connecting" and "Disconnecting" phase of the system VPN is indicative of the time the VPN is actually setting itself up and tearing itself down.
To accomplish this, the privileged helper listens on two different service names. One is connected to by the app, the other the network extension. (Once an XPC listener is connected to, communication is bidirectional)