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