Separate options from service, add system service (#152)

This commit is contained in:
Aleksey Smirnov 2024-09-24 14:05:52 +03:00 committed by GitHub
parent 77ac202f5c
commit dca3b5693a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 36 additions and 9 deletions

22
dist/linux/README.md vendored
View file

@ -9,16 +9,30 @@ sudo make install
## Systemd Service (optional) ## Systemd Service (optional)
Copy and enable the service: You can configure the program to run as systemd service, user- or system-wide (only one at a time).
### As user service:
```sh ```sh
cp byedpi.service ~/.config/systemd/user/ cp byedpi.service ~/.config/systemd/user/
systemctl --user daemon-reload cp byedpi.conf ~/.config/
systemctl --user enable byedpi.service systemctl --user enable --now byedpi.service
systemctl --user start byedpi.service
``` ```
You should see the service now marked as "active": You should see the service now marked as "active":
```sh ```sh
systemctl --user status byedpi.service systemctl --user status byedpi.service
``` ```
### As system service:
```sh
sudo cp byedpi.service /etc/systemd/system/
sudo cp byedpi.conf /etc/
sudo systemctl enable --now byedpi.service
```
You should see the service now marked as "active":
```sh
systemctl status byedpi.service
```

8
dist/linux/byedpi.conf vendored Normal file
View file

@ -0,0 +1,8 @@
# More options and their descriptions can be found here:
# https://github.com/hufrea/byedpi/blob/main/README.md
#
# By default, ciadpi listens on all interfaces,
# a specific one can be specified via "--ip 127.0.0.1".
# Put your options here
BYEDPI_OPTIONS="--split 1 --disorder 3+s --mod-http=h,d --auto=torst --tlsrec 1+s"

View file

@ -1,12 +1,17 @@
[Unit] [Unit]
Description=byedpi Description=ByeDPI
Documentation=https://github.com/hufrea/byedpi Documentation=https://github.com/hufrea/byedpi
Wants=network-online.target
After=network-online.target nss-lookup.target
[Service] [Service]
ExecStart=ciadpi --split 1 --disorder 3+s --mod-http=h,d --auto=torst --tlsrec 1+s NoNewPrivileges=yes
StandardOutput=null
StandardError=journal
EnvironmentFile=-/etc/byedpi.conf
EnvironmentFile=-%h/.config/byedpi.conf
ExecStart=ciadpi $BYEDPI_OPTIONS
TimeoutStopSec=5s TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true PrivateTmp=true
ProtectSystem=full ProtectSystem=full