From 07eacae385f92bfc536b4c7460951e3ac1045ae4 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Sat, 6 Apr 2024 19:06:18 +0800 Subject: [PATCH] Add '--as-gateway' option (#318) --- apps/gpclient/src/connect.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/gpclient/src/connect.rs b/apps/gpclient/src/connect.rs index 62ed2af..212037a 100644 --- a/apps/gpclient/src/connect.rs +++ b/apps/gpclient/src/connect.rs @@ -32,6 +32,8 @@ pub(crate) struct ConnectArgs { user: Option, #[arg(long, short, help = "The VPNC script to use")] script: Option, + #[arg(long, help = "Treat the server as a gateway, instead of a portal")] + as_gateway: bool, #[arg( long, @@ -95,6 +97,12 @@ impl<'a> ConnectHandler<'a> { pub(crate) async fn handle(&self) -> anyhow::Result<()> { let server = self.args.server.as_str(); + let as_gateway = self.args.as_gateway; + + if as_gateway { + info!("Treating the server as a gateway"); + return self.connect_gateway_with_prelogin(server).await; + } let Err(err) = self.connect_portal_with_prelogin(server).await else { return Ok(());