mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-04-26 15:39:59 -07:00
Merge branch 'main' into build-features
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
pub mod hdlc;
|
||||
pub mod diag;
|
||||
pub mod diag_device;
|
||||
pub mod qmdl;
|
||||
pub mod log_codes;
|
||||
pub mod gsmtap;
|
||||
@@ -9,5 +8,9 @@ pub mod pcap;
|
||||
pub mod analysis;
|
||||
pub mod util;
|
||||
|
||||
// bin/check.rs may target windows and does not use this mod
|
||||
#[cfg(target_family = "unix")]
|
||||
pub mod diag_device;
|
||||
|
||||
// re-export telcom_parser, since we use its types in our API
|
||||
pub use telcom_parser;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use nix::sys::utsname::uname;
|
||||
use serde::Serialize;
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
use nix::sys::utsname::uname;
|
||||
|
||||
/// Expose binary and system information.
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct RuntimeMetadata {
|
||||
@@ -23,6 +25,16 @@ impl RuntimeMetadata {
|
||||
/// attributes from `uname(2)` and falling back to values from
|
||||
/// `std::env::consts`.
|
||||
pub fn new() -> Self {
|
||||
let build_target = RuntimeMetadata {
|
||||
rayhunter_version: env!("CARGO_PKG_VERSION").to_owned(),
|
||||
arch: std::env::consts::ARCH.to_string(),
|
||||
system_os: std::env::consts::OS.to_string(),
|
||||
};
|
||||
|
||||
#[cfg(target_family = "windows")]
|
||||
return build_target;
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
match uname() {
|
||||
Ok(utsname) => RuntimeMetadata {
|
||||
rayhunter_version: env!("CARGO_PKG_VERSION").to_owned(),
|
||||
@@ -33,11 +45,7 @@ impl RuntimeMetadata {
|
||||
utsname.release().to_string_lossy(),
|
||||
),
|
||||
},
|
||||
Err(_) => RuntimeMetadata {
|
||||
rayhunter_version: env!("CARGO_PKG_VERSION").to_owned(),
|
||||
arch: std::env::consts::ARCH.to_string(),
|
||||
system_os: std::env::consts::OS.to_string(),
|
||||
},
|
||||
Err(_) => build_target,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user