Merge branch 'fix/fix/clean-dead-code'

This commit is contained in:
2026-06-12 05:12:47 +00:00
8 changed files with 11 additions and 19 deletions

View File

@@ -14,6 +14,7 @@ use crate::shutdown::GracefulShutdown;
use crate::config::ConfigReloadHandle; use crate::config::ConfigReloadHandle;
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum AdminSocketError { pub enum AdminSocketError {
#[error("admin socket disabled (empty path)")] #[error("admin socket disabled (empty path)")]
Disabled, Disabled,

View File

@@ -1,6 +1,5 @@
use serde::Deserialize; use serde::Deserialize;
#[allow(dead_code)]
#[derive(Debug, Clone, Deserialize, PartialEq)] #[derive(Debug, Clone, Deserialize, PartialEq)]
pub struct StaticConfig { pub struct StaticConfig {
pub listeners: Vec<ListenerConfig>, pub listeners: Vec<ListenerConfig>,
@@ -28,7 +27,6 @@ pub fn default_shutdown_timeout_secs() -> u64 {
30 30
} }
#[allow(dead_code)]
#[derive(Debug, Clone, Deserialize, PartialEq)] #[derive(Debug, Clone, Deserialize, PartialEq)]
pub struct ListenerConfig { pub struct ListenerConfig {
pub bind_addr: String, pub bind_addr: String,
@@ -41,17 +39,14 @@ pub struct ListenerConfig {
pub sites: Vec<crate::config::dynamic_config::SiteConfig>, pub sites: Vec<crate::config::dynamic_config::SiteConfig>,
} }
#[allow(dead_code)]
fn default_http_port() -> u32 { fn default_http_port() -> u32 {
80 80
} }
#[allow(dead_code)]
fn default_https_port() -> u16 { fn default_https_port() -> u16 {
443 443
} }
#[allow(dead_code)]
#[derive(Debug, Clone, Deserialize, PartialEq)] #[derive(Debug, Clone, Deserialize, PartialEq)]
pub struct TlsConfig { pub struct TlsConfig {
pub mode: String, pub mode: String,
@@ -69,12 +64,10 @@ pub struct TlsConfig {
pub key_path: String, pub key_path: String,
} }
#[allow(dead_code)]
fn default_acme_directory() -> String { fn default_acme_directory() -> String {
"production".to_string() "production".to_string()
} }
#[allow(dead_code)]
#[derive(Debug, Clone, Deserialize, PartialEq)] #[derive(Debug, Clone, Deserialize, PartialEq)]
pub struct LoggingConfig { pub struct LoggingConfig {
#[serde(default = "default_log_level")] #[serde(default = "default_log_level")]
@@ -85,12 +78,10 @@ pub struct LoggingConfig {
pub log_file_path: Option<String>, pub log_file_path: Option<String>,
} }
#[allow(dead_code)]
fn default_log_level() -> String { fn default_log_level() -> String {
"info".to_string() "info".to_string()
} }
#[allow(dead_code)]
fn default_log_format() -> String { fn default_log_format() -> String {
"text".to_string() "text".to_string()
} }

View File

@@ -7,6 +7,7 @@ use super::dynamic_config::DynamicConfig;
use super::static_config::StaticConfig; use super::static_config::StaticConfig;
#[derive(Debug, Error)] #[derive(Debug, Error)]
#[non_exhaustive]
pub enum ValidationError { pub enum ValidationError {
#[error("at least one listener must be defined")] #[error("at least one listener must be defined")]
NoListeners, NoListeners,

View File

@@ -120,6 +120,7 @@ async fn run_server(loaded_config: cli::LoadedConfig, config_path: &str) -> Resu
AdminSocketError::Io(e) => { AdminSocketError::Io(e) => {
error!("admin socket IO error: {}", e); error!("admin socket IO error: {}", e);
} }
_ => {}
} }
} }
}); });
@@ -183,6 +184,12 @@ async fn run_server(loaded_config: cli::LoadedConfig, config_path: &str) -> Resu
"ACME TLS configured" "ACME TLS configured"
); );
} }
_ => {
warn!(
addr = %listener_config.bind_addr,
"unsupported TLS mode"
);
}
} }
} }

View File

@@ -2,6 +2,7 @@ use axum::http::StatusCode;
use axum::response::{IntoResponse, Response}; use axum::response::{IntoResponse, Response};
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum ProxyError { pub enum ProxyError {
#[error("Bad Gateway")] #[error("Bad Gateway")]
BadGateway { host: String, upstream: String }, BadGateway { host: String, upstream: String },

View File

@@ -12,7 +12,6 @@ use crate::shutdown::GracefulShutdown;
const ACME_TLS_ALPN_01: &[u8] = b"acme-tls/1"; const ACME_TLS_ALPN_01: &[u8] = b"acme-tls/1";
#[allow(dead_code)]
fn build_acme_server_config( fn build_acme_server_config(
resolver: Arc<rustls_acme::ResolvesServerCertAcme>, resolver: Arc<rustls_acme::ResolvesServerCertAcme>,
) -> Result<Arc<ServerConfig>> { ) -> Result<Arc<ServerConfig>> {
@@ -31,8 +30,8 @@ fn build_acme_server_config(
Ok(Arc::new(config)) Ok(Arc::new(config))
} }
#[allow(dead_code)]
#[derive(Debug)] #[derive(Debug)]
#[non_exhaustive]
pub enum TlsMode { pub enum TlsMode {
Manual(Arc<ServerConfig>), Manual(Arc<ServerConfig>),
Acme { Acme {
@@ -41,7 +40,6 @@ pub enum TlsMode {
}, },
} }
#[allow(dead_code)]
pub fn setup_tls(tls_config: &TlsConfig, shutdown: Arc<GracefulShutdown>) -> Result<TlsMode> { pub fn setup_tls(tls_config: &TlsConfig, shutdown: Arc<GracefulShutdown>) -> Result<TlsMode> {
match tls_config.mode.as_str() { match tls_config.mode.as_str() {
"manual" => { "manual" => {

View File

@@ -8,13 +8,10 @@ use tracing::{error, info, warn};
use crate::shutdown::GracefulShutdown; use crate::shutdown::GracefulShutdown;
#[allow(dead_code)]
const LETS_ENCRYPT_PRODUCTION_DIRECTORY: &str = "https://acme-v02.api.letsencrypt.org/directory"; const LETS_ENCRYPT_PRODUCTION_DIRECTORY: &str = "https://acme-v02.api.letsencrypt.org/directory";
#[allow(dead_code)]
const LETS_ENCRYPT_STAGING_DIRECTORY: &str = const LETS_ENCRYPT_STAGING_DIRECTORY: &str =
"https://acme-staging-v02.api.letsencrypt.org/directory"; "https://acme-staging-v02.api.letsencrypt.org/directory";
#[allow(dead_code)]
pub struct AcmeTlsConfig { pub struct AcmeTlsConfig {
pub domains: Vec<String>, pub domains: Vec<String>,
pub cache_dir: PathBuf, pub cache_dir: PathBuf,
@@ -22,7 +19,6 @@ pub struct AcmeTlsConfig {
pub contact: Vec<String>, pub contact: Vec<String>,
} }
#[allow(dead_code)]
pub struct AcmeTlsSetup { pub struct AcmeTlsSetup {
pub resolver: Arc<ResolvesServerCertAcme>, pub resolver: Arc<ResolvesServerCertAcme>,
pub state: AcmeState<std::io::Error, std::io::Error>, pub state: AcmeState<std::io::Error, std::io::Error>,
@@ -54,7 +50,6 @@ impl AcmeTlsConfig {
Ok(AcmeTlsSetup { resolver, state }) Ok(AcmeTlsSetup { resolver, state })
} }
#[allow(dead_code)]
pub fn directory_url(&self) -> &str { pub fn directory_url(&self) -> &str {
match self.directory.as_str() { match self.directory.as_str() {
"production" => LETS_ENCRYPT_PRODUCTION_DIRECTORY, "production" => LETS_ENCRYPT_PRODUCTION_DIRECTORY,
@@ -64,7 +59,6 @@ impl AcmeTlsConfig {
} }
} }
#[allow(dead_code)]
pub fn spawn_acme_state( pub fn spawn_acme_state(
state: AcmeState<std::io::Error, std::io::Error>, state: AcmeState<std::io::Error, std::io::Error>,
domains: Vec<String>, domains: Vec<String>,

View File

@@ -14,7 +14,6 @@ use rustls::ServerConfig;
use rustls::SupportedCipherSuite; use rustls::SupportedCipherSuite;
use rustls_pemfile; use rustls_pemfile;
#[allow(dead_code)]
static RESTRICTED_CIPHER_SUITES: &[SupportedCipherSuite] = &[ static RESTRICTED_CIPHER_SUITES: &[SupportedCipherSuite] = &[
cipher_suite::TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, cipher_suite::TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
cipher_suite::TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, cipher_suite::TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,