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(
|
parsed_upstream.insert(
|
||||||
name.to_string(),
|
name.to_string(),
|
||||||
Upstream::Proxy(ProxyToUpstream {
|
Upstream::Proxy(ProxyToUpstream {
|
||||||
name: name.to_string(),
|
name: name.to_string(),
|
||||||
addr: format!("{}:{}", upstream_host, upstream_port),
|
addr: format!("{}:{}", upstream_host, upstream_port),
|
||||||
protocol: upstream_url.scheme().to_string(),
|
protocol: upstream_url.scheme().to_string(),
|
||||||
addresses: Addr(Mutex::new(UpstreamAddress::new(format!(
|
addresses: Addr(Mutex::new(addr)),
|
||||||
"{}:{}",
|
|
||||||
upstream_host, upstream_port
|
|
||||||
)))),
|
|
||||||
..Default::default()
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -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(
|
async fn process(
|
||||||
@ -86,7 +86,7 @@ async fn process(
|
|||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
match upstream {
|
match upstream {
|
||||||
Upstream::Ban => {
|
Upstream::Ban => {
|
||||||
let _ = inbound.shutdown();
|
inbound.shutdown().await?;
|
||||||
}
|
}
|
||||||
Upstream::Echo => {
|
Upstream::Echo => {
|
||||||
let (mut ri, mut wi) = io::split(inbound);
|
let (mut ri, mut wi) = io::split(inbound);
|
||||||
|
Loading…
Reference in New Issue
Block a user