intermediate minor optimization

This commit is contained in:
Ara Sadoyan
2025-10-01 13:47:30 +02:00
parent bd5fed9be0
commit 3541b20c80
2 changed files with 4 additions and 4 deletions

View File

@@ -250,8 +250,8 @@ pub fn drop_priv(user: String, group: String, http_addr: String, tls_addr: Optio
} }
} }
pub fn check_priv(addr: String) { pub fn check_priv(addr: &str) {
let port = SocketAddr::from_str(&addr).map(|sa| sa.port()).unwrap(); let port = SocketAddr::from_str(addr).map(|sa| sa.port()).unwrap();
match port < 1024 { match port < 1024 {
true => { true => {
let meta = std::fs::metadata("/proc/self").map(|m| m.uid()).unwrap(); let meta = std::fs::metadata("/proc/self").map(|m| m.uid()).unwrap();

View File

@@ -55,11 +55,11 @@ pub fn run() {
let bind_address_http = cfg.proxy_address_http.clone(); let bind_address_http = cfg.proxy_address_http.clone();
let bind_address_tls = cfg.proxy_address_tls.clone(); let bind_address_tls = cfg.proxy_address_tls.clone();
check_priv(bind_address_http.clone()); check_priv(bind_address_http.as_str());
match bind_address_tls { match bind_address_tls {
Some(bind_address_tls) => { Some(bind_address_tls) => {
check_priv(bind_address_tls.clone()); check_priv(bind_address_tls.as_str());
let (tx, rx): (Sender<Vec<CertificateConfig>>, Receiver<Vec<CertificateConfig>>) = channel(); let (tx, rx): (Sender<Vec<CertificateConfig>>, Receiver<Vec<CertificateConfig>>) = channel();
let certs_path = cfg.proxy_certificates.clone().unwrap(); let certs_path = cfg.proxy_certificates.clone().unwrap();
thread::spawn(move || { thread::spawn(move || {