Skip to content

Commit

Permalink
Add '--as-gateway' option (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuezk committed Apr 6, 2024
1 parent 8446874 commit 07eacae
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions apps/gpclient/src/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ pub(crate) struct ConnectArgs {
user: Option<String>,
#[arg(long, short, help = "The VPNC script to use")]
script: Option<String>,
#[arg(long, help = "Treat the server as a gateway, instead of a portal")]
as_gateway: bool,

#[arg(
long,
Expand Down Expand Up @@ -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(());
Expand Down

0 comments on commit 07eacae

Please sign in to comment.