Skip to content

feat: pass agent updates to UI #35

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

Merged
merged 2 commits into from
Feb 10, 2025
Merged

feat: pass agent updates to UI #35

merged 2 commits into from
Feb 10, 2025

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Jan 31, 2025

Closes #5.

  • Passes Agent updates over XPC to the UI, displaying them on the menubar app
  • GUI now receives notifications when the system VPN state changes.
image

Copy link
Member Author

ethanndickson commented Jan 31, 2025

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated from coder/coder

PRODUCT_BUNDLE_IDENTIFIER: com.coder.Coder-Desktop.CoderSDKTests

VPNXPC:
type: framework
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we import VPNLib into the app for the peer update protobuf type, we might as well just put the contents of this framework there.

guard uuidData.count == 16 else {
return nil
}
var uuid: uuid_t = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very funny: there's no fixed size arrays in Swift (probably cause of objc), so uuid_t is just a tuple of 16 u8s.
Also, the proposal to add one includes calling that new type a Vector https://forums.swift.org/t/second-review-se-0453-vector-a-fixed-size-array/76412/20

logger.error("network extension reported error: \(error)")
tunnelState = .failed(.internalError(error.localizedDescription))
extension CoderVPNService {
@objc private func vpnDidUpdate(_ notification: Notification) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS can tell us when the Network Extension changes state, including if there was an error that caused it to disconnect, e.g. NE crashes, ptp.cancelTunnelWithError, start/stop completionHandler(err)

@ethanndickson ethanndickson marked this pull request as ready for review January 31, 2025 05:40
@ethanndickson ethanndickson merged commit 10c2109 into main Feb 10, 2025
4 checks passed
@ethanndickson ethanndickson self-assigned this Feb 12, 2025
@ethanndickson ethanndickson deleted the ethan/agents-to-ui branch February 12, 2025 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build XPC communication from the Network Extension back to the user App
3 participants