Improve code style
Signed-off-by: Jacob Kiers <code@kiers.eu>
This commit is contained in:
parent
84f0499ec8
commit
23296c6436
@ -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)),
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user