refactor(rust): move uptime to bin-shared (#9027)

The `uptime` module from `firezone-headless-client` is also used in the
GUI client. In order to decouple this dependency, we move the module to
`bin-shared`, next to the other cross-plaform modules.
This commit is contained in:
Thomas Eizinger
2025-05-05 22:28:26 +10:00
committed by GitHub
parent 2d802edf6a
commit 80335676b1
6 changed files with 5 additions and 4 deletions

View File

@@ -23,6 +23,8 @@ pub mod macos;
#[cfg(target_os = "macos")]
pub use macos as platform;
pub mod uptime;
pub const TOKEN_ENV_KEY: &str = "FIREZONE_TOKEN";
// wintun automatically append " Tunnel" to this

View File

@@ -177,7 +177,7 @@ fn show_error_dialog(msg: &str) -> Result<()> {
/// Don't drop the log handle or logging will stop.
fn start_logging(directives: &str) -> Result<common::logging::Handles> {
let logging_handles = common::logging::setup(directives)?;
let system_uptime_seconds = firezone_headless_client::uptime::get().map(|dur| dur.as_secs());
let system_uptime_seconds = firezone_bin_shared::uptime::get().map(|dur| dur.as_secs());
tracing::info!(
arch = std::env::consts::ARCH,
os = std::env::consts::OS,

View File

@@ -167,7 +167,7 @@ fn run_debug_ipc_service(cli: Cli) -> Result<()> {
tracing::info!(
arch = std::env::consts::ARCH,
// version = env!("CARGO_PKG_VERSION"), TODO: Fix once `ipc_service` is moved to `gui-client`.
system_uptime_seconds = crate::uptime::get().map(|dur| dur.as_secs()),
system_uptime_seconds = firezone_bin_shared::uptime::get().map(|dur| dur.as_secs()),
);
if !platform::elevation_check()? {
bail!("IPC service failed its elevation check, try running as admin / root");
@@ -668,7 +668,7 @@ fn setup_logging(
tracing::info!(
arch = std::env::consts::ARCH,
// version = env!("CARGO_PKG_VERSION"), TODO: Fix once `ipc_service` is moved to `gui-client`.
system_uptime_seconds = crate::uptime::get().map(|dur| dur.as_secs()),
system_uptime_seconds = firezone_bin_shared::uptime::get().map(|dur| dur.as_secs()),
%directives
);

View File

@@ -32,7 +32,6 @@ mod ipc_service;
pub mod known_dirs;
// TODO: Move to `bin-shared`?
pub mod signals;
pub mod uptime;
pub use clear_logs::clear_logs;
pub use dns_control::DnsController;