with_auth/with_auth.rs
1//! SOCKS5 server with username/password authentication example
2
3use soxide::{Socks5Server, auth::UserPass};
4
5#[tokio::main]
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 tracing_subscriber::fmt::init();
8
9 let auth = UserPass {
10 username: "<user>".to_string(),
11 password: "<pass>".to_string(),
12 };
13
14 let server = Socks5Server::new("127.0.0.1:1080").with_auth(Some(auth));
15
16 server.run().await?;
17 Ok(())
18}