Add '--as-gateway' option (#318)

This commit is contained in:
Kevin Yue 2024-04-06 19:06:18 +08:00
parent 8446874290
commit 07eacae385

View File

@ -32,6 +32,8 @@ pub(crate) struct ConnectArgs {
user: Option<String>, user: Option<String>,
#[arg(long, short, help = "The VPNC script to use")] #[arg(long, short, help = "The VPNC script to use")]
script: Option<String>, script: Option<String>,
#[arg(long, help = "Treat the server as a gateway, instead of a portal")]
as_gateway: bool,
#[arg( #[arg(
long, long,
@ -95,6 +97,12 @@ impl<'a> ConnectHandler<'a> {
pub(crate) async fn handle(&self) -> anyhow::Result<()> { pub(crate) async fn handle(&self) -> anyhow::Result<()> {
let server = self.args.server.as_str(); 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 { let Err(err) = self.connect_portal_with_prelogin(server).await else {
return Ok(()); return Ok(());