mirror of
https://github.com/sadoyan/aralez.git
synced 2026-04-29 22:38:36 +08:00
intermediate minor optimization
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
@@ -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 || {
|
||||||
|
|||||||
Reference in New Issue
Block a user