|
@ -55,10 +55,9 @@ async fn main() -> Result<()> { |
|
|
let socks_address = args.socks_address; |
|
|
let socks_address = args.socks_address; |
|
|
let port = args.port; |
|
|
let port = args.port; |
|
|
|
|
|
|
|
|
let auth = match args.auth { |
|
|
let auth = args |
|
|
Some(auth) => Some(Auth::new(auth.username, auth.password)), |
|
|
.auth |
|
|
None => None, |
|
|
.map(|auth| Auth::new(auth.username, auth.password)); |
|
|
}; |
|
|
|
|
|
let auth = &*Box::leak(Box::new(auth)); |
|
|
let auth = &*Box::leak(Box::new(auth)); |
|
|
|
|
|
|
|
|
let addr = SocketAddr::from((args.listen_ip, port)); |
|
|
let addr = SocketAddr::from((args.listen_ip, port)); |
|
@ -72,10 +71,9 @@ async fn main() -> Result<()> { |
|
|
}; |
|
|
}; |
|
|
let client: Client<SocksConnector<HttpConnector>> = hyper::Client::builder().build(connector); |
|
|
let client: Client<SocksConnector<HttpConnector>> = hyper::Client::builder().build(connector); |
|
|
let client = &*Box::leak(Box::new(client)); |
|
|
let client = &*Box::leak(Box::new(client)); |
|
|
let allowed_domains = match args.allowed_domains { |
|
|
let allowed_domains = args |
|
|
Some(domains) => Some(domains.split(',').map(|d| d.trim().to_owned()).collect()), |
|
|
.allowed_domains |
|
|
None => None, |
|
|
.map(|domains| domains.split(',').map(|d| d.trim().to_owned()).collect()); |
|
|
}; |
|
|
|
|
|
let allowed_domains = &*Box::leak(Box::new(allowed_domains)); |
|
|
let allowed_domains = &*Box::leak(Box::new(allowed_domains)); |
|
|
let make_service = make_service_fn(move |_| async move { |
|
|
let make_service = make_service_fn(move |_| async move { |
|
|
Ok::<_, Infallible>(service_fn(move |req| { |
|
|
Ok::<_, Infallible>(service_fn(move |req| { |
|
|