use slinger_mitm::{InterceptorFactory, MitmConfig, MitmProxy};
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("=== Slinger MITM Proxy ===\n");
let config = MitmConfig::default();
let proxy = MitmProxy::new(config).await?;
let interceptor_handler = proxy.interceptor_handler();
let mut handler = interceptor_handler.write().await;
handler.add_interceptor(Arc::new(InterceptorFactory::logging()));
drop(handler);
println!("Starting MITM proxy on 127.0.0.1:8080");
println!("CA certificate: {}\n", proxy.ca_cert_path().display());
println!("To use this proxy:");
println!("1. Configure your browser to use HTTP proxy: 127.0.0.1:8080");
println!("2. Install the CA certificate in your browser/system");
println!("3. Visit any HTTP/HTTPS website\n");
proxy.start("127.0.0.1:2008").await?;
Ok(())
}