fix: android build & CONFIG deadlock

This commit is contained in:
csf
2022-07-28 22:06:59 +08:00
parent 6bbfe13028
commit da2906c95f
7 changed files with 36 additions and 18 deletions

View File

@@ -39,6 +39,10 @@ pub use tokio_socks::IntoTargetAddr;
pub use tokio_socks::TargetAddr;
pub mod password_security;
lazy_static::lazy_static!{
static ref UUID: Vec<u8> = gen_uuid();
}
#[cfg(feature = "quic")]
pub type Stream = quic::Connection;
#[cfg(not(feature = "quic"))]
@@ -202,12 +206,16 @@ pub fn get_modified_time(path: &std::path::Path) -> SystemTime {
.unwrap_or(UNIX_EPOCH)
}
pub fn get_uuid() -> Vec<u8> {
fn gen_uuid() -> Vec<u8> {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
if let Ok(id) = machine_uid::get() {
return id.into();
}
Config::get_key_pair().1
Config::get_sk_uuid()
}
pub fn get_uuid() -> Vec<u8> {
UUID.to_owned()
}
#[cfg(test)]