fix rustfmt formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,8 +14,8 @@ pub mod question;
|
||||
pub mod record;
|
||||
pub mod service_store;
|
||||
pub mod stats;
|
||||
pub mod tls;
|
||||
pub mod system_dns;
|
||||
pub mod tls;
|
||||
|
||||
pub type Error = Box<dyn std::error::Error + Send + Sync>;
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
@@ -152,7 +152,10 @@ async fn main() -> numa::Result<()> {
|
||||
if config.blocking.enabled { format!("{} lists", config.blocking.lists.len()) } else { "disabled".to_string() });
|
||||
if config.proxy.enabled {
|
||||
let schemes = if config.proxy.tls_port > 0 {
|
||||
format!("http://:{} https://:{}", config.proxy.port, config.proxy.tls_port)
|
||||
format!(
|
||||
"http://:{} https://:{}",
|
||||
config.proxy.port, config.proxy.tls_port
|
||||
)
|
||||
} else {
|
||||
format!("http://*.{} on :{}", config.proxy.tld, config.proxy.port)
|
||||
};
|
||||
|
||||
15
src/proxy.rs
15
src/proxy.rs
@@ -43,10 +43,7 @@ pub async fn start_proxy(ctx: Arc<ServerCtx>, port: u16) {
|
||||
.http1_preserve_header_case(true)
|
||||
.build_http();
|
||||
|
||||
let state = ProxyState {
|
||||
ctx,
|
||||
client,
|
||||
};
|
||||
let state = ProxyState { ctx, client };
|
||||
|
||||
let app = Router::new().fallback(any(proxy_handler)).with_state(state);
|
||||
|
||||
@@ -72,10 +69,7 @@ pub async fn start_proxy_tls(ctx: Arc<ServerCtx>, port: u16, tls_config: Arc<Ser
|
||||
.http1_preserve_header_case(true)
|
||||
.build_http();
|
||||
|
||||
let state = ProxyState {
|
||||
ctx,
|
||||
client,
|
||||
};
|
||||
let state = ProxyState { ctx, client };
|
||||
|
||||
let app = Router::new().fallback(any(proxy_handler)).with_state(state);
|
||||
|
||||
@@ -148,7 +142,10 @@ async fn proxy_handler(State(state): State<ProxyState>, req: Request) -> axum::r
|
||||
None => {
|
||||
return (
|
||||
StatusCode::BAD_GATEWAY,
|
||||
format!("unknown service: {}{}", service_name, state.ctx.proxy_tld_suffix),
|
||||
format!(
|
||||
"unknown service: {}{}",
|
||||
service_name, state.ctx.proxy_tld_suffix
|
||||
),
|
||||
)
|
||||
.into_response()
|
||||
}
|
||||
|
||||
@@ -95,7 +95,10 @@ impl ServiceStore {
|
||||
}
|
||||
}
|
||||
if count > 0 {
|
||||
info!("loaded {} persisted services from {:?}", count, self.persist_path);
|
||||
info!(
|
||||
"loaded {} persisted services from {:?}",
|
||||
count, self.persist_path
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(e) => warn!("failed to parse {:?}: {}", self.persist_path, e),
|
||||
|
||||
@@ -28,7 +28,11 @@ pub fn build_tls_config(tld: &str, service_names: &[String]) -> crate::Result<Ar
|
||||
.with_no_client_auth()
|
||||
.with_single_cert(cert_chain, key)?;
|
||||
|
||||
info!("TLS configured for {} .{} domains", service_names.len(), tld);
|
||||
info!(
|
||||
"TLS configured for {} .{} domains",
|
||||
service_names.len(),
|
||||
tld
|
||||
);
|
||||
Ok(Arc::new(config))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user