mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 16:21:24 +01:00
support listening on Unix sockets
This commit is contained in:
parent
188eac5cfd
commit
868bb44adf
10 changed files with 202 additions and 34 deletions
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue