mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-03-30 12:05:38 +00:00
Add systemd units
This commit is contained in:
10
Makefile
10
Makefile
@@ -9,13 +9,13 @@ clean:
|
||||
rm -f doh-client/doh-client doh-server/doh-server
|
||||
|
||||
install: doh-client/doh-client doh-server/doh-server
|
||||
install -Dm0755 doh-client/doh-client $(PREFIX)/bin/doh-client
|
||||
install -Dm0755 doh-server/doh-server $(PREFIX)/bin/doh-server
|
||||
setcap cap_net_bind_service=+ep $(PREFIX)/bin/doh-client
|
||||
setcap cap_net_bind_service=+ep $(PREFIX)/bin/doh-server
|
||||
install -Dm0755 doh-client/doh-client "$(DESTDIR)$(PREFIX)/bin/doh-client"
|
||||
install -Dm0755 doh-server/doh-server "$(DESTDIR)$(PREFIX)/bin/doh-server"
|
||||
$(MAKE) -C systemd install "DESTDIR=$(DESTDIR)" "PREFIX=$(PREFIX)"
|
||||
|
||||
uninstall:
|
||||
rm -f $(PREFIX)/bin/doh-client $(PREFIX)/bin/doh-server
|
||||
rm -f "$(DESTDIR)$(PREFIX)/bin/doh-client" "$(DESTDIR)$(PREFIX)/bin/doh-server"
|
||||
$(MAKE) -C systemd uninstall "DESTDIR=$(DESTDIR)" "PREFIX=$(PREFIX)"
|
||||
|
||||
doh-client/doh-client: doh-client/client.go doh-client/main.go json-dns/error.go json-dns/globalip.go json-dns/marshal.go json-dns/response.go json-dns/unmarshal.go
|
||||
cd doh-client && $(GOBUILD)
|
||||
|
||||
14
systemd/Makefile
Normal file
14
systemd/Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
.PHONY: install uninstall
|
||||
|
||||
PREFIX = /usr/local
|
||||
SYSTEMD_DIR = /usr/lib/systemd
|
||||
SYSTEMD_UNIT_DIR = $(SYSTEMD_DIR)/system
|
||||
|
||||
install:
|
||||
install -Dm0644 doh-client.service "$(DESTDIR)$(SYSTEMD_UNIT_DIR)/doh-client.service"
|
||||
install -Dm0644 doh-server.service "$(DESTDIR)$(SYSTEMD_UNIT_DIR)/doh-server.service"
|
||||
systemctl daemon-reload || true
|
||||
|
||||
uninstall:
|
||||
rm -f "$(DESTDIR)$(SYSTEMD_UNIT_DIR)/doh-client.service" "$(DESTDIR)$(SYSTEMD_UNIT_DIR)/doh-server.service"
|
||||
systemctl daemon-reload || true
|
||||
15
systemd/doh-client.service
Normal file
15
systemd/doh-client.service
Normal file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=DNS-over-HTTPS Client
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
ExecStart=/usr/local/bin/doh-client -addr :53 -upstream https://dns.google.com/resolve
|
||||
LimitNOFILE=1048576
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
Type=simple
|
||||
User=nobody
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
15
systemd/doh-server.service
Normal file
15
systemd/doh-server.service
Normal file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=DNS-over-HTTPS Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
ExecStart=/usr/local/bin/doh-server
|
||||
LimitNOFILE=1048576
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
Type=simple
|
||||
User=nobody
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user