- Notifications
You must be signed in to change notification settings - Fork5
Commit8533b31
authored
chore: run coder connect networking from launchdaemon (#203)
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)```mermaidsequenceDiagram note left of App: User requests to start VPN: App->>+NetExt: Start VPN NetExt->>+PrivHelper: Request start VPN with TUN FD note right of PrivHelper: Privileged helper downloads and verifies binary. PrivHelper->>Tunnel: posix_spawn child process with FDs PrivHelper->>+Tunnel: Send proto start request Tunnel-->>-PrivHelper: Send proto start response PrivHelper->>+NetExt: Request for network config change NetExt-->>-PrivHelper: Response for network config change PrivHelper-->>-NetExt: Start VPN respons NetExt-->>-App: VPN started App->>PrivHelper: Request peer state PrivHelper->>Tunnel: Request peer state Tunnel-->>PrivHelper: Peer state response PrivHelper-->>App: Peer state response note left of App: Tunnel updates (bypass NetExt): Tunnel->>PrivHelper: Tunnel update proto message PrivHelper->>App: Tunnel update proto message note left of App: User requests to stop VPN: App->>+NetExt: Stop VPN NetExt->>+PrivHelper: Request stop VPN PrivHelper->>+Tunnel: Request stop VPN Tunnel-->>-PrivHelper: Stop VPN response note right of Tunnel: Tunnel binary exits PrivHelper-->>-NetExt: Stop VPN response NetExt-->>-App: VPN stopped```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)1 parent99c912b commit8533b31
File tree
20 files changed
+527
-486
lines changed- Coder-Desktop
- Coder-DesktopHelper
- Coder-Desktop
- VPN
- Views
- VPNLib
- VPN
20 files changed
+527
-486
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + |
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
54 | 54 |
| |
55 | 55 |
| |
56 | 56 |
| |
57 |
| - | |
| 57 | + | |
58 | 58 |
| |
59 | 59 |
| |
60 | 60 |
| |
| |||
138 | 138 |
| |
139 | 139 |
| |
140 | 140 |
| |
141 |
| - | |
| 141 | + | |
142 | 142 |
| |
143 | 143 |
| |
144 |
| - | |
| 144 | + | |
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
| |||
199 | 199 |
| |
200 | 200 |
| |
201 | 201 |
| |
202 |
| - | |
203 |
| - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
204 | 205 |
| |
205 | 206 |
| |
206 | 207 |
| |
207 | 208 |
| |
208 | 209 |
| |
209 | 210 |
| |
210 |
| - | |
211 |
| - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
212 | 214 |
| |
213 | 215 |
| |
214 | 216 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
90 | 90 |
| |
91 | 91 |
| |
92 | 92 |
| |
93 |
| - | |
| 93 | + | |
94 | 94 |
| |
95 | 95 |
| |
96 | 96 |
| |
| |||
192 | 192 |
| |
193 | 193 |
| |
194 | 194 |
| |
195 |
| - | |
| 195 | + | |
196 | 196 |
| |
197 | 197 |
| |
198 |
| - | |
| 198 | + | |
199 | 199 |
| |
200 | 200 |
| |
201 |
| - | |
| 201 | + | |
202 | 202 |
| |
203 | 203 |
| |
204 | 204 |
| |
| |||
221 | 221 |
| |
222 | 222 |
| |
223 | 223 |
| |
224 |
| - | |
| 224 | + | |
225 | 225 |
| |
226 | 226 |
| |
227 | 227 |
| |
|
This file was deleted.
0 commit comments
Comments
(0)