You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Systemd can open root level ports and pass a socket to another process. This is helpful because the program can run in user-level permission but appear to be listening to port 80.
use listenfd::ListenFd;
use std::net::TcpListener;
fn main() {
let mut listenfd = ListenFd::from_env();
// Try to get socket from systemd first
let listener = match listenfd.take_tcp_listener(0).unwrap() {
// Got socket from systemd
Some(l) => l,
// No systemd socket, create our own
None => TcpListener::bind("0.0.0.0:80").unwrap()
};
}
The text was updated successfully, but these errors were encountered:
Systemd can open root level ports and pass a socket to another process. This is helpful because the program can run in user-level permission but appear to be listening to port 80.
See golang port for an example of the idea: https://github.com/librespeed/speedtest-go/pull/35/files#diff-17bd1293d66c18344655b66a75ac56c5798e7407a1670834166b12ee3585ad2b
Rust similar code to activate this
The text was updated successfully, but these errors were encountered: