support listening on Unix sockets

This commit is contained in:
LordMZTE 2025-05-24 15:18:42 +02:00
parent 188eac5cfd
commit 868bb44adf
No known key found for this signature in database
GPG key ID: B64802DC33A64FF6
10 changed files with 202 additions and 34 deletions

View file

@ -196,11 +196,16 @@ pub(crate) enum ListenTransport {
#[serde(default = "false_fn")]
proxy_protocol: bool,
},
Unix {
path: PathBuf,
#[serde(default = "false_fn")]
proxy_protocol: bool,
},
}
impl Display for ListenTransport {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
match self {
ListenTransport::Tcp {
address,
port,
@ -209,12 +214,12 @@ impl Display for ListenTransport {
} => {
let scheme = format!(
"{}{}",
if proxy_protocol {
if *proxy_protocol {
"proxy+"
} else {
""
},
if tls {
if *tls {
"https"
} else {
"http"
@ -222,6 +227,21 @@ impl Display for ListenTransport {
);
write!(f, "{scheme}://{address}:{port}")
}
ListenTransport::Unix {
path,
proxy_protocol,
} => {
write!(
f,
"{}http+unix://{}",
if *proxy_protocol {
"proxy+"
} else {
""
},
path.display()
)
}
}
}
}