Support systemd socket activation (#35)

* Support systemd socket activation

If the process has been started with systemd socket activation
configured, then serve requests on the passed-in socket instead of
attempting to bind to an address.

* Add example systemd unit files.

Add example systemd unit files which make use of systemd's security
facilities, and also allow binding to port 80 whilst running as an
unpriviliged process (using systemd socket activation).
This commit is contained in:
Tim Small
2022-01-18 07:47:32 +00:00
committed by GitHub
parent 281aff1725
commit c67b8ec91d
5 changed files with 231 additions and 3 deletions
+11
View File
@@ -0,0 +1,11 @@
# Socket listener systemd unit file for speedtest-go. See the
# systemd.socket(5) manual page for many more options.
[Unit]
Description=Speedtest Web Server (http port 80) Socket
[Socket]
ListenStream=80
Accept=no
[Install]
WantedBy=sockets.target