mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
feat: gpauth support macos
This commit is contained in:
@@ -5,7 +5,7 @@ edition.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[dependencies]
|
||||
gpapi = { path = "../../crates/gpapi" }
|
||||
gpapi = { path = "../../crates/gpapi", features = ["clap"] }
|
||||
openconnect = { path = "../../crates/openconnect" }
|
||||
clap.workspace = true
|
||||
anyhow.workspace = true
|
||||
|
@@ -3,13 +3,14 @@ use std::{collections::HashMap, io::Write};
|
||||
|
||||
use anyhow::bail;
|
||||
use clap::Parser;
|
||||
use gpapi::clap::InfoLevelVerbosity;
|
||||
use gpapi::{
|
||||
process::gui_launcher::GuiLauncher,
|
||||
service::{request::WsRequest, vpn_state::VpnState},
|
||||
utils::{crypto::generate_key, env_utils, lock_file::LockFile, redact::Redaction, shutdown_signal},
|
||||
GP_SERVICE_LOCK_FILE,
|
||||
};
|
||||
use log::{info, warn, LevelFilter};
|
||||
use log::{info, warn};
|
||||
use tokio::sync::{mpsc, watch};
|
||||
|
||||
use crate::{vpn_task::VpnTask, ws_server::WsServer};
|
||||
@@ -26,6 +27,9 @@ struct Cli {
|
||||
#[cfg(debug_assertions)]
|
||||
#[clap(long)]
|
||||
no_gui: bool,
|
||||
|
||||
#[command(flatten)]
|
||||
verbose: InfoLevelVerbosity,
|
||||
}
|
||||
|
||||
impl Cli {
|
||||
@@ -102,12 +106,12 @@ impl Cli {
|
||||
}
|
||||
}
|
||||
|
||||
fn init_logger() -> Arc<Redaction> {
|
||||
fn init_logger(cli: &Cli) -> Arc<Redaction> {
|
||||
let redaction = Arc::new(Redaction::new());
|
||||
let redaction_clone = Arc::clone(&redaction);
|
||||
// let target = Box::new(File::create("log.txt").expect("Can't create file"));
|
||||
|
||||
env_logger::builder()
|
||||
.filter_level(LevelFilter::Info)
|
||||
.filter_level(cli.verbose.log_level_filter())
|
||||
.format(move |buf, record| {
|
||||
let timestamp = buf.timestamp();
|
||||
writeln!(
|
||||
@@ -153,7 +157,7 @@ async fn launch_gui(envs: Option<HashMap<String, String>>, api_key: Vec<u8>, mut
|
||||
pub async fn run() {
|
||||
let mut cli = Cli::parse();
|
||||
|
||||
let redaction = init_logger();
|
||||
let redaction = init_logger(&cli);
|
||||
info!("gpservice started: {}", VERSION);
|
||||
|
||||
if let Err(e) = cli.run(redaction).await {
|
||||
|
Reference in New Issue
Block a user