Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: improve vpn configuration errors#208

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 1 commit intomainfromethan/vpn-config-errors
Aug 6, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletionsCoder-Desktop/Coder-Desktop/VPN/NetworkExtension.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,7 @@ enum NetworkExtensionState: Equatable {
case .disabled:
"NetworkExtension tunnel disabled"
case let .failed(error):
"NetworkExtension config failed: \(error)"
"NetworkExtension: \(error)"
}
}
}
Expand DownExpand Up@@ -44,7 +44,7 @@ extension CoderVPNService {
try await removeNetworkExtension()
} catch {
logger.error("remove tunnel failed: \(error)")
neState = .failed(error.localizedDescription)
neState = .failed("Failed to remove configuration: \(error.description)")
return
}
logger.debug("inserting new tunnel")
Expand All@@ -60,7 +60,9 @@ extension CoderVPNService {
} catch {
// This typically fails when the user declines the permission dialog
logger.error("save tunnel failed: \(error)")
neState = .failed("Failed to save tunnel: \(error.localizedDescription). Try logging in and out again.")
neState = .failed(
"Failed to save configuration: \(error.localizedDescription). Try logging in and out again."
)
}
}

Expand All@@ -71,17 +73,24 @@ extension CoderVPNService {
try await tunnel.removeFromPreferences()
}
} catch {
throw .internalError("couldn't remove tunnels: \(error)")
throw .internalError(error.localizedDescription)
}
}

func startTunnel() async {
let tm: NETunnelProviderManager
do {
tm = try await getTunnelManager()
} catch {
logger.error("get tunnel: \(error)")
neState = .failed("Failed to get VPN configuration: \(error.description)")
return
}
do {
let tm = try await getTunnelManager()
try tm.connection.startVPNTunnel()
} catch {
logger.error("start tunnel: \(error)")
neState = .failed(error.localizedDescription)
neState = .failed("Failed to start VPN tunnel: \(error.localizedDescription)")
return
}
logger.debug("started tunnel")
Expand All@@ -94,7 +103,7 @@ extension CoderVPNService {
tm.connection.stopVPNTunnel()
} catch {
logger.error("stop tunnel: \(error)")
neState = .failed(error.localizedDescription)
neState = .failed("Failed to stop VPN tunnel: \(error.localizedDescription)")
return
}
logger.debug("stopped tunnel")
Expand Down
10 changes: 5 additions & 5 deletionsCoder-Desktop/Coder-Desktop/VPN/VPNService.swift
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@ enum VPNServiceError: Error, Equatable {
case systemExtensionError(SystemExtensionState)
case networkExtensionError(NetworkExtensionState)

var description: String {
publicvar description: String {
switch self {
case let .internalError(description):
"Internal Error: \(description)"
Expand All@@ -48,7 +48,7 @@ enum VPNServiceError: Error, Equatable {
}
}

var localizedDescription: String { description }
publicvar localizedDescription: String { description }
}

@MainActor
Expand DownExpand Up@@ -126,13 +126,13 @@ final class CoderVPNService: NSObject, VPNService {
// this just configures the VPN, it doesn't enable it
tunnelState = .disabled
} else {
do {
dothrows(VPNServiceError){
try await removeNetworkExtension()
neState = .unconfigured
tunnelState = .disabled
} catch {
logger.error("failed to removenetwork extension: \(error)")
neState = .failed(error.localizedDescription)
logger.error("failed to removeconfiguration: \(error)")
neState = .failed("Failed to remove configuration: \(error.description)")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletionCoder-Desktop/project.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -98,7 +98,7 @@ packages:
# - Set onAppear/disappear handlers.
# The upstream repo has a purposefully limited API
url: https://github.com/coder/fluid-menu-bar-extra
revision:8e1d8b8
revision:b0d5438
KeychainAccess:
url: https://github.com/kishikawakatsumi/KeychainAccess
branch: e0c7eebc5a4465a3c4680764f26b7a61f567cdaf
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp