1pub mod autostart;
4pub mod clipboard;
5pub mod fs;
6pub mod input;
7pub mod local_socket;
8pub mod notify;
9pub mod permissions;
10
11#[must_use]
13pub fn host_name() -> Option<String> {
14 let name = os_host_name()?;
15 let name: String = name
16 .chars()
17 .take(a7n_proto::limits::PEER_NAME_MAX)
18 .collect();
19 (!name.is_empty()).then_some(name)
20}
21
22#[cfg(unix)]
23fn os_host_name() -> Option<String> {
24 rustix::system::uname()
25 .nodename()
26 .to_str()
27 .ok()
28 .map(str::to_owned)
29}
30
31#[cfg(windows)]
32fn os_host_name() -> Option<String> {
33 std::env::var("COMPUTERNAME").ok()
34}
35
36#[cfg(feature = "tray")]
37pub mod tray;
38
39#[must_use]
41pub const fn platform() -> a7n_proto::v1::Platform {
42 use a7n_proto::v1::Platform;
43
44 if cfg!(target_os = "macos") {
45 Platform::Macos
46 } else if cfg!(target_os = "windows") {
47 Platform::Windows
48 } else if cfg!(target_os = "linux") {
49 Platform::Linux
50 } else {
51 Platform::Unspecified
52 }
53}
54
55pub mod transfer_fs;
56
57mod network;
58pub use network::{hw_addr_for, ipv4_broadcasts, local_addr_for};