llldap/src/main.rs

35 lines
883 B
Rust
Raw Normal View History

2026-09-01 15:27:28 +02:00
// #![deny(warnings)]
mod cli;
mod error;
mod ldap;
2026-09-01 15:27:28 +02:00
mod listener;
mod stream;
use cli::CliArgs;
use error::GlobalError;
use ldap::ldap_handler;
2026-09-01 15:27:28 +02:00
use listener::ListenerPath;
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), GlobalError> {
let cli: CliArgs = argh::from_env();
tracing_subscriber::fmt::init();
// let subscriber = tracing_subscriber::FmtSubscriber::new();
// .with_file(true)
// .with_line_number(true)
// .finish()
// .init();
// tracing::subscriber::set_global_default(subscriber)?;
let listener = ListenerPath::new(&cli.listen)?.listener().await?;
// If the connection is None, it's because the client aborted early
// so there's nothing to do about it.
while let Some(stream) = listener.accept_ldap().await? {
tokio::spawn(ldap_handler(stream));
2026-09-01 15:27:28 +02:00
}
Ok(())
}