mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 14:36:15 -05:00
feat: install trusted VPN scripts
This commit is contained in:
23 files changed
+454
-11
No files matched your search
@@ -0,0 +1,15 @@
|
||||
use gpapi::service::request::ConnectArgs;
|
||||
use openconnect::{Vpn, VpnBuilder};
|
||||
|
||||
use super::selection::{ScriptSource, select};
|
||||
|
||||
pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> anyhow::Result<VpnBuilder> {
|
||||
let installed = gpservice::vpnc_script::installed_script()?;
|
||||
match select(installed.as_deref(), args.vpnc_script()) {
|
||||
ScriptSource::Installed(path) => {
|
||||
Ok(Vpn::builder(server, cookie).script_path(Some(path.to_string_lossy().into_owned())))
|
||||
}
|
||||
ScriptSource::Legacy(script) => Ok(Vpn::builder(server, cookie).script(Some(script.to_owned()))),
|
||||
ScriptSource::Default => Ok(Vpn::builder(server, cookie).script_path(None)),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user