Deduplicate some code

Signed-off-by: Jacob Kiers <code@kiers.eu>
This commit is contained in:
Jacob Kiers 2023-10-05 13:32:59 +02:00
parent 17b39dc6bc
commit bb81a32349

View File

@ -84,19 +84,7 @@ impl Server {
); );
let handle = tokio::spawn(async move { let handle = tokio::spawn(async move {
match config.protocol.as_ref() { match config.protocol.as_ref() {
"tcp" => { "tcp" | "tcp4" | "tcp6" => {
let res = tcp::proxy(config.clone()).await;
if res.is_err() {
error!("Failed to start {}: {}", config.name, res.err().unwrap());
}
}
"tcp4" => {
let res = tcp::proxy(config.clone()).await;
if res.is_err() {
error!("Failed to start {}: {}", config.name, res.err().unwrap());
}
}
"tcp6" => {
let res = tcp::proxy(config.clone()).await; let res = tcp::proxy(config.clone()).await;
if res.is_err() { if res.is_err() {
error!("Failed to start {}: {}", config.name, res.err().unwrap()); error!("Failed to start {}: {}", config.name, res.err().unwrap());