feat: implement Unix domain socket admin API for config reload and status

Add admin socket module that binds to a configurable Unix domain socket
path (default /run/reverse-proxy/admin.sock) supporting reload and status
commands. Reload re-reads config and swaps DynamicConfig via ArcSwap with
serialized access using the same Mutex as SIGHUP. Status returns uptime
and site count. Unknown commands and invalid input return structured
JSON error responses. Stale socket files are removed at startup; if the
socket is occupied by another process, a warning is logged and the socket
is disabled. Empty admin_socket_path disables the socket entirely.

Also adds FullConfig struct to config module for parsing complete config
files during reload, and adds serde_json dependency for JSON responses.
This commit is contained in:
2026-06-11 13:13:15 +00:00
parent f1cada010f
commit 56eda4e47c
6 changed files with 710 additions and 18 deletions

14
Cargo.lock generated
View File

@@ -1593,6 +1593,7 @@ dependencies = [
"rustls-pemfile",
"rustls-pki-types",
"serde",
"serde_json",
"signal-hook",
"tempfile",
"thiserror 2.0.18",
@@ -1799,15 +1800,14 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.150"
version = "1.0.140"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9"
checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
"serde_core",
"zmij",
]
[[package]]
@@ -2803,9 +2803,3 @@ dependencies = [
"quote",
"syn",
]
[[package]]
name = "zmij"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa"