Provider configuration is persisted into module (#730)

When e.g. a OpenVPNModule is created without a configuration and a
provider/server is then selected, the ProfileProcessor class serializes
the profile with the provider configuration injected. When the module is
re-edited, we can see the provider server configuration in the module
after selecting "None" as provider.

Instead, validate the provider modules in ProfileProcessor, but generate the provider configuration on the fly in the tunnel.
This commit is contained in:
Davide 2024-10-12 13:19:46 +02:00 committed by GitHub
parent 2517c4b39b
commit 9769a151db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 13 deletions

View File

@ -41,8 +41,7 @@
"kind" : "remoteSourceControl",
"location" : "git@github.com:passepartoutvpn/passepartoutkit-source",
"state" : {
"revision" : "126392d2614c9d0ffe2aa2d96f6c5509221b8481",
"version" : "0.9.0"
"revision" : "0bfd4578b71a905584cdd5c9c39ab3087521af78"
}
},
{

View File

@ -27,8 +27,8 @@ let package = Package(
)
],
dependencies: [
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.9.0"),
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "bec0635fe047e09c8b6c894d103ab8dd741b8340"),
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", from: "0.9.0"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source", revision: "0bfd4578b71a905584cdd5c9c39ab3087521af78"),
// .package(path: "../../../passepartoutkit-source"),
.package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", from: "0.8.0"),
// .package(url: "git@github.com:passepartoutvpn/passepartoutkit-source-openvpn-openssl", revision: "031863a1cd683962a7dfe68e20b91fa820a1ecce"),

View File

@ -136,13 +136,14 @@ extension ProfileProcessor {
}
}
let processed = try builder.tryBuild()
let profile = try builder.tryBuild()
do {
return try processed.withProviderModules()
_ = try profile.withProviderModules()
return profile
} catch {
// FIXME: #703, alert unable to build provider server
pp_log(.app, .error, "Unable to inject provider modules: \(error)")
return processed
throw error
}
}
}

View File

@ -36,15 +36,16 @@ final class PacketTunnelProvider: NEPacketTunnelProvider, @unchecked Sendable {
parameters: Constants.shared.log,
logsPrivateData: UserDefaults.appGroup.bool(forKey: AppPreference.logsPrivateData.key)
)
fwd = try await NEPTPForwarder(
provider: self,
decoder: Registry.sharedProtocolCoder,
registry: .shared,
environment: .shared
)
do {
fwd = try await NEPTPForwarder(
provider: self,
decoder: Registry.sharedProtocolCoder,
registry: .shared,
environment: .shared
)
try await fwd?.startTunnel(options: options)
} catch {
pp_log(.app, .fault, "Unable to start tunnel: \(error)")
PassepartoutConfiguration.shared.flushLog()
throw error
}