netpulse/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Netpulse is a network monitoring tool that performs connectivity checks and stores results for analysis.
//!
//! # Architecture
//!
//! The crate is organized into several key modules:
//! - [`store`] - Handles persistence of check results
//! - [`records`] - Defines core types for representing checks and their results
//! - [`checks`] - Implements the actual connectivity checks
//! - [`analyze`] - Provides analysis of check results
//! - [`errors`] - Error types
//! - [`analyze`] - Analysis functionalities for extrapolating the data in the [Store](store)
//!
//! # Example Usage
//!
//! ```rust,no_run
//! use netpulse::store::Store;
//!
//! // Load or create store
//! let mut store = Store::load_or_create().unwrap();
//!
//! // Add checks for configured targets
//! store.make_checks();
//!
//! // Save results
//! store.save().unwrap();
//! ```

#![warn(missing_docs)]

/// How long to wait until considering a connection as timed out, in milliseconds
pub const TIMEOUT_MS: u16 = 10_000;
/// How long to wait until considering a connection as timed out
pub const TIMEOUT: std::time::Duration = std::time::Duration::new(TIMEOUT_MS as u64 / 1000, 0);

/// Lockfile of the daemon containing it#s pid
pub const DAEMON_PID_FILE: &str = "/run/netpulse/netpulse.pid";
/// Redirect the stderr of the daemon here
pub const DAEMON_LOG_ERR: &str = "/var/log/netpulse.err";
/// Redirect the stdout of the daemon here
pub const DAEMON_LOG_INF: &str = "/var/log/netpulse.log";
/// username of the user the daemon should drop to after being started
pub const DAEMON_USER: &str = "netpulse";

pub mod analyze;
pub mod checks;
#[cfg(feature = "executable")]
pub mod common;
pub mod errors;
pub mod records;
pub mod store;