mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 14:36:15 -05:00
feat: build and publish Windows NSH packages with verified updates
This commit is contained in:
113 files changed
+7264
-801
No files matched your search
@@ -0,0 +1,24 @@
|
||||
use gpapi::service::request::ConnectArgs;
|
||||
use openconnect::{Vpn, VpnBuilder};
|
||||
use std::sync::Mutex;
|
||||
const RECOVERY_KEY: &str = r"SOFTWARE\GP Connect\NetworkRecovery";
|
||||
|
||||
pub(crate) fn recover_network() -> std::io::Result<()> {
|
||||
gpvpnc::windows::recover(RECOVERY_KEY)
|
||||
}
|
||||
|
||||
pub(crate) fn builder(server: &str, cookie: &str, args: &ConnectArgs) -> anyhow::Result<VpnBuilder> {
|
||||
anyhow::ensure!(
|
||||
args.vpnc_script().is_none(),
|
||||
"Windows does not support custom VPN scripts"
|
||||
);
|
||||
let network = Mutex::new(gpvpnc::windows::NetworkConfigurator::new(RECOVERY_KEY)?);
|
||||
Ok(
|
||||
Vpn::builder(server, cookie).network_configuration_handler(move |configuration| {
|
||||
network
|
||||
.lock()
|
||||
.map_err(|_| std::io::Error::other("Windows network state is unavailable"))?
|
||||
.configure(&configuration.reason, &configuration.environment)
|
||||
}),
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user