Allow protected to be set from cli

This commit is contained in:
Dreaded_X 2025-04-10 17:05:58 +02:00
parent 2749f3d1cf
commit 8a628d51a6
Signed by: Dreaded_X
GPG Key ID: 5A0CBFE3C3377FAA

View File

@ -167,8 +167,11 @@ impl Handler {
#[command(version, about, long_about = None)] #[command(version, about, long_about = None)]
struct Args { struct Args {
/// Make all tunnels public by default instead of private /// Make all tunnels public by default instead of private
#[arg(short, long)] #[arg(long, group = "access")]
public: bool, public: bool,
#[arg(long, group = "access")]
protected: bool,
} }
impl russh::server::Handler for Handler { impl russh::server::Handler for Handler {
@ -244,6 +247,11 @@ impl russh::server::Handler for Handler {
self.set_access_all(TunnelAccess::Public).await; self.set_access_all(TunnelAccess::Public).await;
self.redraw().await?; self.redraw().await?;
} }
if args.protected {
trace!("Making tunnels protected");
self.set_access_all(TunnelAccess::Protected).await;
self.redraw().await?;
}
} }
Err(err) => { Err(err) => {
trace!("Sending help message and disconnecting"); trace!("Sending help message and disconnecting");