We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentf970cfc commit98c184dCopy full SHA for 98c184d
Coder Desktop/Coder Desktop/Coder_DesktopApp.swift
@@ -49,6 +49,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
49
name:.NEVPNStatusDidChange,
50
object:nil
51
)
52
+Task{
53
+ // If there's no NE config, then the user needs to sign in.
54
+ // However, they might have a session from a previous install, so we
55
+ // need to clear it.
56
+ifawait !vpn.loadNetworkExtensionConfig(){
57
+ state.clearSession()
58
+}
59
60
}
61
62
// This function MUST eventually call `NSApp.reply(toApplicationShouldTerminate: true)`
Coder Desktop/Coder Desktop/NetworkExtension.swift
@@ -24,13 +24,16 @@ enum NetworkExtensionState: Equatable {
24
/// An actor that handles configuring, enabling, and disabling the VPN tunnel via the
25
/// NetworkExtension APIs.
26
extensionCoderVPNService{
27
-func loadNetworkExtensionConfig()async{
+ // Attempts to load the NetworkExtension configuration, returning true if successful.
28
+func loadNetworkExtensionConfig()async->Bool{
29
do{
30
lettm=tryawaitgetTunnelManager()
31
neState=.disabled
32
serverAddress= tm.protocolConfiguration?.serverAddress
33
+returntrue
34
}catch{
35
neState=.unconfigured
36
+returnfalse
37
38
39
Coder Desktop/Coder Desktop/VPNService.swift
@@ -35,6 +35,8 @@ enum VPNServiceError: Error, Equatable {
state.description
+
+varlocalizedDescription:String{ description}
40
41
42
@MainActor
@@ -67,9 +69,6 @@ final class CoderVPNService: NSObject, VPNService {
67
69
overrideinit(){
68
70
super.init()
71
installSystemExtension()
-Task{
-awaitloadNetworkExtensionConfig()
72
-}
73
74
75
deinit{
Coder Desktop/Coder Desktop/Views/LoginForm.swift
@@ -204,6 +204,8 @@ enum LoginError: Error {
204
"Could not authenticate with Coder deployment:\n\(err.description)"
205
206
207
208
209
210
211
enumLoginPage{
Coder Desktop/Coder Desktop/Views/VPNMenu.swift
@@ -89,6 +89,7 @@ struct VPNMenu<VPN: VPNService>: View {
89
!state.hasSession ||
90
vpn.state==.connecting ||
91
vpn.state==.disconnecting ||
92
+ // Prevent starting the VPN before the user has approved the system extension.
93
vpn.state==.failed(.systemExtensionError(.needsUserApproval))
94
95
Coder Desktop/CoderSDK/Client.swift
@@ -134,4 +134,6 @@ public enum ClientError: Error {
134
"Failed to encode body:\(error)"
135
136
137
138
+publicvarlocalizedDescription:String{ description}
139
Coder Desktop/VPN/Manager.swift
@@ -276,6 +276,8 @@ enum ManagerError: Error {
276
"Failed to communicate with dylib over tunnel:\(err)"
277
278
279
280
281
282
283
func writeVpnLog(_ log:Vpn_Log){
Coder Desktop/VPN/TunnelHandle.swift
@@ -82,6 +82,8 @@ enum TunnelHandleError: Error {
82
caselet.close(errs):"close tunnel:\(errs.map(\.localizedDescription).joined(separator:","))"
83
84
85
86
87
88
enumOpenTunnelError:Int32{
Coder Desktop/VPNLib/Download.swift
@@ -11,7 +11,7 @@ public enum ValidationError: Error {
11
case missingInfoPList
12
case invalidVersion(version:String?)
13
14
-publicvarerrorDescription:String?{
+publicvardescription:String{
15
switchself{
16
case.fileNotFound:
17
"The file does not exist."
@@ -31,6 +31,8 @@ public enum ValidationError: Error {
"Info.plist is not embedded within the dylib."
publicclassSignatureValidator{
@@ -156,7 +158,7 @@ public enum DownloadError: Error {
156
158
case networkError(anyError)
157
159
case fileOpError(anyError)
160
-varlocalizedDescription:String{
161
162
163
caselet.unexpectedStatusCode(code):
164
"Unexpected HTTP status code:\(code)"
@@ -168,4 +170,6 @@ public enum DownloadError: Error {
168
170
"Received non-HTTP response"
169
171
172
173
174
175
Coder Desktop/VPNLib/Receiver.swift
@@ -75,9 +75,18 @@ actor Receiver<RecvMsg: Message> {
76
77
78
-enumReceiveError:Error{
+publicenumReceiveError:Error{
79
case readError(String)
80
case invalidLength
81
+switchself{
+caselet.readError(err):"read error:\(err)"
+case.invalidLength:"invalid message length"
func deserializeLen(_ data:Data)throws->UInt32{