Skip to content

Instantly share code, notes, and snippets.

@SukkaW
Last active July 19, 2023 10:06
Show Gist options
  • Save SukkaW/88a748fcd9faa93675789bdb24b95762 to your computer and use it in GitHub Desktop.
Save SukkaW/88a748fcd9faa93675789bdb24b95762 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Created by Sukka (https://skk.moe)
# wget --no-check-certificate -O snell.sh https://gist.githubusercontent.com/SukkaW/88a748fcd9faa93675789bdb24b95762/raw/snell.sh && chmod +x snell.sh && ./snell.sh && rm -rf snell.sh
CONF="/etc/snell/snell-server.conf"
SYSTEMD="/etc/systemd/system/snell.service"
PSK="o_sase_sd_wan_is_the_best_6666"
apt-get update -y
apt-get install unzip curl -y
cd ~/
wget --no-check-certificate -O snell.zip https://github.com/icpz/open-snell/releases/download/v3.0.1/snell-server-linux-amd64.zip
unzip -o snell.zip
rm -f snell.zip
chmod +x snell-server
mv -f snell-server /usr/local/bin/
if [ -f ${CONF} ]; then
echo "[sukka snell] Found existing config..."
else
mkdir -p /etc/snell/
echo "[sukka snell] Generating new config..."
echo "[snell-server]" >>${CONF}
echo "listen = 0.0.0.0:14514" >>${CONF}
echo "psk = ${PSK}" >>${CONF}
fi
if [ -f ${SYSTEMD} ]; then
echo "[sukka snell] Found existing snell service, restart"
systemctl daemon-reload
systemctl restart snell
else
echo "[sukka snell] Generating new service..."
echo "[Unit]" >>${SYSTEMD}
echo "Description=Snell Proxy Service" >>${SYSTEMD}
echo "After=network.target" >>${SYSTEMD}
echo "" >>${SYSTEMD}
echo "[Service]" >>${SYSTEMD}
echo "Type=simple" >>${SYSTEMD}
echo "LimitNOFILE=32768" >>${SYSTEMD}
echo "ExecStart=/usr/local/bin/snell-server -c /etc/snell/snell-server.conf" >>${SYSTEMD}
echo "" >>${SYSTEMD}
echo "[Install]" >>${SYSTEMD}
echo "WantedBy=multi-user.target" >>${SYSTEMD}
echo "[sukka snell] Starting snell..."
systemctl daemon-reload
systemctl enable snell
systemctl start snell
fi
echo "[sukka snell] pasting the following in clash config:"
echo " - name: \"snell\""
echo " type: snell"
echo " server: # 请替换为服务器 IP"
echo " port: 14514"
echo " psk: o_sase_sd_wan_is_the_best_6666"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment