Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 116 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ anyhow = "1.0.98"
reqwest = { version = "0.12.20", default-features = false }
rustls-rustcrypto = { version = "0.0.2-alpha", optional = true }
async-trait = "0.1.88"
axum-server = { version = "0.7", default-features = false, features = ["tls-rustls-no-provider"] }
rustls = { version = "0.23", default-features = false, features = ["ring", "std", "tls12"] }
rcgen = "0.13"
rustls-pemfile = "2.2"
16 changes: 16 additions & 0 deletions daemon/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ pub struct Config {
pub ntfy_url: Option<String>,
pub enabled_notifications: Vec<NotificationType>,
pub analyzers: AnalyzerConfig,
/// Enable HTTPS on https_port (generates self-signed cert on first use)
pub https_enabled: bool,
/// HTTPS port (only active when https_enabled = true)
#[serde(default = "default_https_port")]
pub https_port: u16,
/// Custom hostnames/IPs to include in TLS certificate SANs.
/// If empty, uses device-specific defaults. Can include IPs or DNS names.
#[serde(default)]
pub tls_hosts: Vec<String>,
}

fn default_https_port() -> u16 {
8443
}

impl Default for Config {
Expand All @@ -35,6 +48,9 @@ impl Default for Config {
analyzers: AnalyzerConfig::default(),
ntfy_url: None,
enabled_notifications: vec![NotificationType::Warning, NotificationType::LowBattery],
https_enabled: false,
https_port: default_https_port(),
tls_hosts: Vec::new(),
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions daemon/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ pub enum RayhunterError {
BatteryPluggedInStatusParseError,
#[error("The requested functionality is not supported for this device")]
FunctionNotSupportedForDeviceError,
#[error("TLS error: {0}")]
TlsError(String),
#[error("Server error: {0}")]
ServerError(String),
}
Loading