FIX: TLS options

This commit is contained in:
2026-03-10 16:52:13 +00:00
parent 67547d677c
commit b7bbaa2d33
8 changed files with 291 additions and 34 deletions

View File

@@ -10,8 +10,8 @@ use furumi_client_core::FurumiClient;
#[derive(Parser, Debug)]
#[command(version, about = "Furumi-ng: mount remote filesystem via encrypted gRPC + FUSE")]
struct Args {
/// Server address (use https:// for encrypted, http:// for plaintext)
#[arg(short, long, env = "FURUMI_SERVER", default_value = "https://0.0.0.0:50051")]
/// Server address (IP:PORT, will use https:// by default unless --no-tls is specified)
#[arg(short, long, env = "FURUMI_SERVER", default_value = "0.0.0.0:50051")]
server: String,
/// Authentication Bearer token (leave empty if auth is disabled on server)
@@ -21,6 +21,10 @@ struct Args {
/// Mount point directory
#[arg(short, long, env = "FURUMI_MOUNT")]
mount: PathBuf,
/// Disable TLS encryption
#[arg(long, default_value_t = false)]
no_tls: bool,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -38,8 +42,22 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.enable_all()
.build()?;
let full_addr = if args.no_tls {
if args.server.starts_with("http://") || args.server.starts_with("https://") {
args.server.clone()
} else {
format!("http://{}", args.server)
}
} else {
if args.server.starts_with("http://") || args.server.starts_with("https://") {
args.server.clone()
} else {
format!("https://{}", args.server)
}
};
let client = rt.block_on(async {
FurumiClient::connect(&args.server, &args.token).await
FurumiClient::connect(&full_addr, &args.token).await
})?;
let fuse_fs = fs::FurumiFuse::new(client, rt.handle().clone());