feat: persist VPN script installation metadata

This commit is contained in:
Kevin Yue committed 2026-07-30 22:06:18 +08:00
1 parent 6999b2725e
commit 40b35804e7
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(),
}
}