From dca3b5693a8fbdaafec12267d587022fd1174562 Mon Sep 17 00:00:00 2001 From: Aleksey Smirnov Date: Tue, 24 Sep 2024 14:05:52 +0300 Subject: [PATCH] Separate options from service, add system service (#152) --- dist/linux/README.md | 22 ++++++++++++++++++---- dist/linux/byedpi.conf | 8 ++++++++ dist/linux/byedpi.service | 15 ++++++++++----- 3 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 dist/linux/byedpi.conf diff --git a/dist/linux/README.md b/dist/linux/README.md index 96db4d8..f211b46 100644 --- a/dist/linux/README.md +++ b/dist/linux/README.md @@ -9,16 +9,30 @@ sudo make install ## 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 cp byedpi.service ~/.config/systemd/user/ -systemctl --user daemon-reload -systemctl --user enable byedpi.service -systemctl --user start byedpi.service +cp byedpi.conf ~/.config/ +systemctl --user enable --now byedpi.service ``` You should see the service now marked as "active": ```sh 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 +``` diff --git a/dist/linux/byedpi.conf b/dist/linux/byedpi.conf new file mode 100644 index 0000000..e52e18a --- /dev/null +++ b/dist/linux/byedpi.conf @@ -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" diff --git a/dist/linux/byedpi.service b/dist/linux/byedpi.service index af986ae..7abe067 100644 --- a/dist/linux/byedpi.service +++ b/dist/linux/byedpi.service @@ -1,14 +1,19 @@ [Unit] -Description=byedpi +Description=ByeDPI Documentation=https://github.com/hufrea/byedpi +Wants=network-online.target +After=network-online.target nss-lookup.target [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 -LimitNOFILE=1048576 -LimitNPROC=512 PrivateTmp=true ProtectSystem=full [Install] -WantedBy=default.target \ No newline at end of file +WantedBy=default.target