mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-19 06:26:14 -05:00
feat: persist VPN script installation metadata
This commit is contained in:
10 files changed
+276
-39
No files matched your search
@@ -1,9 +1,12 @@
|
||||
use std::io;
|
||||
use std::io::Read;
|
||||
|
||||
use anyhow::bail;
|
||||
use clap::{Parser, Subcommand};
|
||||
use gpapi::service::vpnc_script::InstallVpncScriptRequest;
|
||||
use nix::unistd::Uid;
|
||||
|
||||
const MAX_INSTALL_REQUEST_SIZE: u64 = 2 * 1024 * 1024;
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
@@ -22,7 +25,11 @@ fn try_run() -> anyhow::Result<()> {
|
||||
}
|
||||
|
||||
match Cli::parse().command {
|
||||
Command::Install => gpservice::vpnc_script::install(io::stdin().lock()),
|
||||
Command::Install => {
|
||||
let input = std::io::stdin().lock().take(MAX_INSTALL_REQUEST_SIZE);
|
||||
let request = serde_json::from_reader::<_, InstallVpncScriptRequest>(input)?;
|
||||
gpservice::vpnc_script::install(request)
|
||||
}
|
||||
Command::Remove => gpservice::vpnc_script::remove(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user