Improve code style

Signed-off-by: Jacob Kiers <code@kiers.eu>
This commit is contained in:
Jacob Kiers 2023-10-04 22:33:11 +02:00
parent 84f0499ec8
commit 23296c6436
2 changed files with 4 additions and 7 deletions

View File

@ -150,17 +150,14 @@ fn load_config(path: &str) -> Result<ParsedConfig, ConfigError> {
}
}
let addr = UpstreamAddress::new(format!("{}:{}", upstream_host, upstream_port));
parsed_upstream.insert(
name.to_string(),
Upstream::Proxy(ProxyToUpstream {
name: name.to_string(),
addr: format!("{}:{}", upstream_host, upstream_port),
protocol: upstream_url.scheme().to_string(),
addresses: Addr(Mutex::new(UpstreamAddress::new(format!(
"{}:{}",
upstream_host, upstream_port
)))),
..Default::default()
addresses: Addr(Mutex::new(addr)),
}),
);
}

View File

@ -77,7 +77,7 @@ async fn accept(inbound: TcpStream, proxy: Arc<Proxy>) -> Result<(), Box<dyn std
}
};
return process(inbound, &upstream).await;
process(inbound, upstream).await
}
async fn process(
@ -86,7 +86,7 @@ async fn process(
) -> Result<(), Box<dyn std::error::Error>> {
match upstream {
Upstream::Ban => {
let _ = inbound.shutdown();
inbound.shutdown().await?;
}
Upstream::Echo => {
let (mut ri, mut wi) = io::split(inbound);