Merge remote-tracking branch 'origin/main' into feat/windows-service
# Conflicts: # src/main.rs
This commit is contained in:
@@ -160,6 +160,7 @@ struct QueryLogResponse {
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct StatsResponse {
|
||||
version: &'static str,
|
||||
uptime_secs: u64,
|
||||
upstream: String,
|
||||
mode: &'static str, // "recursive" or "forward" — never "auto" at runtime
|
||||
@@ -539,6 +540,7 @@ async fn stats(State(ctx): State<Arc<ServerCtx>>) -> Json<StatsResponse> {
|
||||
};
|
||||
|
||||
Json(StatsResponse {
|
||||
version: crate::version(),
|
||||
uptime_secs: snap.uptime_secs,
|
||||
upstream,
|
||||
mode: ctx.upstream_mode.as_str(),
|
||||
|
||||
@@ -43,7 +43,7 @@ impl HealthMeta {
|
||||
#[cfg(test)]
|
||||
pub fn test_fixture() -> Self {
|
||||
HealthMeta {
|
||||
version: env!("CARGO_PKG_VERSION"),
|
||||
version: crate::version(),
|
||||
hostname: "test-host".to_string(),
|
||||
sni: "numa.numa".to_string(),
|
||||
dot_enabled: false,
|
||||
@@ -99,7 +99,7 @@ impl HealthMeta {
|
||||
}
|
||||
|
||||
HealthMeta {
|
||||
version: env!("CARGO_PKG_VERSION"),
|
||||
version: crate::version(),
|
||||
hostname: crate::hostname(),
|
||||
sni: "numa.numa".to_string(),
|
||||
dot_enabled,
|
||||
|
||||
@@ -38,6 +38,14 @@ pub(crate) mod testutil;
|
||||
pub type Error = Box<dyn std::error::Error + Send + Sync>;
|
||||
pub type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
/// Build version string. On tagged releases: `0.13.1`. On commits ahead
|
||||
/// of a tag: `0.13.1+a87f907`. With uncommitted changes: `0.13.1+a87f907-dirty`.
|
||||
/// Falls back to `CARGO_PKG_VERSION` when built outside a git repo (e.g.
|
||||
/// from a source tarball).
|
||||
pub fn version() -> &'static str {
|
||||
option_env!("NUMA_BUILD_VERSION").unwrap_or(env!("CARGO_PKG_VERSION"))
|
||||
}
|
||||
|
||||
/// Detect the machine hostname via the `hostname` command. Returns the
|
||||
/// full hostname (e.g., `macbook-pro.local`), or `"numa"` if the command
|
||||
/// fails. Call sites that need the short form (e.g., mDNS instance
|
||||
|
||||
Reference in New Issue
Block a user