diff --git a/release/local/config.json b/release/local/config.json new file mode 100644 index 00000000..d20c9050 --- /dev/null +++ b/release/local/config.json @@ -0,0 +1,14 @@ +{ + "log": { + "level": "info" + }, + "inbounds": [ + { + "type": "shadowsocks", + "listen": "::", + "listen_port": 8080, + "method": "2022-blake3-aes-128-gcm", + "password": "8JCsPssfgS8tiRwiMlhARg==" + } + ] +} diff --git a/release/local/enable.sh b/release/local/enable.sh new file mode 100755 index 00000000..19929921 --- /dev/null +++ b/release/local/enable.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e -o pipefail + +sudo systemctl enable sing-box +sudo systemctl start sing-box +sudo journalctl -u sing-box --output cat -f diff --git a/release/local/install.sh b/release/local/install.sh new file mode 100755 index 00000000..13846e6a --- /dev/null +++ b/release/local/install.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e -o pipefail + +DIR=$(dirname "$0") +PROJECT=$DIR/../.. + +pushd $PROJECT +go install -v -trimpath -ldflags "-s -w -buildid=" -tags "no_gvisor" ./cmd/sing-box +popd + +sudo cp $(go env GOPATH)/bin/sing-box /usr/local/bin/ +sudo mkdir -p /usr/local/etc/sing-box +sudo cp $DIR/config.json /usr/local/etc/sing-box/config.json +sudo cp $DIR/sing-box.service /etc/systemd/system +sudo systemctl daemon-reload diff --git a/release/local/sing-box.service b/release/local/sing-box.service new file mode 100644 index 00000000..0943fcef --- /dev/null +++ b/release/local/sing-box.service @@ -0,0 +1,13 @@ +[Unit] +Description=sing-box service +Documentation=https://sing-box.sagernet.org +After=network.target nss-lookup.target + +[Service] +ExecStart=/usr/local/bin/sing-box run -c /usr/local/etc/sing-box/config.json +Restart=on-failure +RestartSec=10s +LimitNOFILE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/release/local/uninstall.sh b/release/local/uninstall.sh new file mode 100755 index 00000000..11fa930a --- /dev/null +++ b/release/local/uninstall.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +sudo systemctl stop sing-box +sudo rm -rf /usr/local/bin/sing-box +sudo rm -rf /usr/local/etc/sing-box +sudo rm -rf /etc/systemd/system/sing-box.service +sudo systemctl daemon-reload diff --git a/release/local/update.sh b/release/local/update.sh new file mode 100755 index 00000000..1dcdb3ed --- /dev/null +++ b/release/local/update.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -e -o pipefail + +DIR=$(dirname "$0") +PROJECT=$DIR/../.. + +pushd $PROJECT +git fetch +git reset FETCH_HEAD --hard +git clean -fdx +go install -v -trimpath -ldflags "-s -w -buildid=" -tags "no_gvisor" ./cmd/sing-box +popd + +sudo systemctl stop sing-box +sudo cp $(go env GOPATH)/bin/sing-box /usr/local/bin/ +sudo systemctl start sing-box +sudo journalctl -u sing-box --output cat -f