diff --git a/Cargo.toml b/Cargo.toml index d5c0914..5e9b6ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ homepage = "https://github.com/blechschmidt/tun2proxy" authors = ["B. Blechschmidt", "ssrlive"] description = "Tunnel interface to proxy" readme = "README.md" -rust-version = "1.77" +rust-version = "1.80" [lib] crate-type = ["staticlib", "cdylib", "lib"] @@ -26,7 +26,6 @@ hashlink = "0.9" hickory-proto = "0.24" httparse = "1" ipstack = { version = "0.1" } -lazy_static = "1" log = { version = "0.4", features = ["std"] } percent-encoding = "2" socks5-impl = { version = "0.5" } diff --git a/src/traffic_status.rs b/src/traffic_status.rs index ef38d91..3117a22 100644 --- a/src/traffic_status.rs +++ b/src/traffic_status.rs @@ -1,5 +1,6 @@ use crate::error::{Error, Result}; use std::os::raw::c_void; +use std::sync::{LazyLock, Mutex}; /// # Safety /// @@ -44,10 +45,8 @@ unsafe impl Sync for TrafficStatusCallback {} static TRAFFIC_STATUS_CALLBACK: std::sync::Mutex> = std::sync::Mutex::new(None); static SEND_INTERVAL_SECS: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1); -lazy_static::lazy_static! { - static ref TRAFFIC_STATUS: std::sync::Mutex = std::sync::Mutex::new(TrafficStatus::default()); - static ref TIME_STAMP: std::sync::Mutex = std::sync::Mutex::new(std::time::Instant::now()); -} +static TRAFFIC_STATUS: LazyLock> = LazyLock::new(|| Mutex::new(TrafficStatus::default())); +static TIME_STAMP: LazyLock> = LazyLock::new(|| Mutex::new(std::time::Instant::now())); pub(crate) fn traffic_status_update(delta_tx: usize, delta_rx: usize) -> Result<()> { {