FIX: AutoTLS via RustTLS

This commit is contained in:
2026-03-10 16:30:45 +00:00
parent bf16ff40f9
commit 67547d677c
4 changed files with 132 additions and 63 deletions

View File

@@ -10,7 +10,7 @@ use furumi_client_core::FurumiClient;
#[derive(Parser, Debug)]
#[command(version, about = "Furumi-ng: mount remote filesystem via encrypted gRPC + FUSE")]
struct Args {
/// Server address to connect to (use https:// for encrypted connection)
/// Server address (use https:// for encrypted, http:// for plaintext)
#[arg(short, long, env = "FURUMI_SERVER", default_value = "https://0.0.0.0:50051")]
server: String,
@@ -21,10 +21,6 @@ struct Args {
/// Mount point directory
#[arg(short, long, env = "FURUMI_MOUNT")]
mount: PathBuf,
/// Path to server's TLS CA certificate PEM file (required for https:// connections)
#[arg(long, env = "FURUMI_TLS_CA")]
tls_ca: Option<PathBuf>,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
@@ -36,17 +32,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
eprintln!("Error: Mount point {:?} does not exist or is not a directory", args.mount);
std::process::exit(1);
}
// Load TLS CA certificate if provided
let tls_ca_pem = if let Some(ref ca_path) = args.tls_ca {
let pem = std::fs::read(ca_path).unwrap_or_else(|e| {
eprintln!("Error: Failed to read TLS CA cert {:?}: {}", ca_path, e);
std::process::exit(1);
});
Some(pem)
} else {
None
};
// Create a robust tokio runtime for the background gRPC work
let rt = tokio::runtime::Builder::new_multi_thread()
@@ -54,7 +39,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.build()?;
let client = rt.block_on(async {
FurumiClient::connect(&args.server, &args.token, tls_ca_pem).await
FurumiClient::connect(&args.server, &args.token).await
})?;
let fuse_fs = fs::FurumiFuse::new(client, rt.handle().clone());