mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 02:09:06 +00:00
101f416268
Use noise protocol on handshake. Check peer's public key if needed. Also support rekey and replay attack prevention. E2EE and temporary password will be implemented based on this.
45 lines
1.3 KiB
Rust
45 lines
1.3 KiB
Rust
macro_rules! define_global_var {
|
|
($name:ident, $type:ty, $init:expr) => {
|
|
pub static $name: once_cell::sync::Lazy<std::sync::Mutex<$type>> =
|
|
once_cell::sync::Lazy::new(|| std::sync::Mutex::new($init));
|
|
};
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! use_global_var {
|
|
($name:ident) => {
|
|
$crate::common::constants::$name.lock().unwrap().to_owned()
|
|
};
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! set_global_var {
|
|
($name:ident, $val:expr) => {
|
|
*$crate::common::constants::$name.lock().unwrap() = $val
|
|
};
|
|
}
|
|
|
|
define_global_var!(MANUAL_CONNECTOR_RECONNECT_INTERVAL_MS, u64, 1000);
|
|
|
|
define_global_var!(OSPF_UPDATE_MY_GLOBAL_FOREIGN_NETWORK_INTERVAL_SEC, u64, 10);
|
|
|
|
define_global_var!(MACHINE_UID, Option<String>, None);
|
|
|
|
define_global_var!(MAX_DIRECT_CONNS_PER_PEER_IN_FOREIGN_NETWORK, u32, 3);
|
|
|
|
define_global_var!(DIRECT_CONNECT_TO_PUBLIC_SERVER, bool, true);
|
|
|
|
// must make it true in future.
|
|
define_global_var!(HMAC_SECRET_DIGEST, bool, false);
|
|
|
|
pub const UDP_HOLE_PUNCH_CONNECTOR_SERVICE_ID: u32 = 2;
|
|
|
|
pub const WIN_SERVICE_WORK_DIR_REG_KEY: &str = "SOFTWARE\\EasyTier\\Service\\WorkDir";
|
|
|
|
pub const EASYTIER_VERSION: &str = git_version::git_version!(
|
|
args = ["--abbrev=8", "--always", "--dirty=~"],
|
|
prefix = concat!(env!("CARGO_PKG_VERSION"), "-"),
|
|
suffix = "",
|
|
fallback = env!("CARGO_PKG_VERSION")
|
|
);
|