Last active
January 8, 2022 16:16
-
-
Save qzi/1544bf9b1c2ceec3fc0c2b696330161c to your computer and use it in GitHub Desktop.
For snell v3.0.0rc2 on ubuntu aarch64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin | |
export PATH | |
CONF="/etc/snell/snell-server.conf" | |
SYSTEMD="/etc/systemd/system/snell.service" | |
apt-get install unzip -y | |
cd ~/ | |
wget --no-check-certificate -O snell.zip https://github.com/surge-networks/snell/releases/download/v3.0.0rc2/snell-server-v3.0.0-linux-aarch64.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 "Found existing config..." | |
else | |
if [ -z ${PSK} ]; then | |
PSK=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 16) | |
echo "Using generated PSK: ${PSK}" | |
else | |
echo "Using predefined PSK: ${PSK}" | |
fi | |
mkdir /etc/snell/ | |
echo "Generating new config..." | |
echo "[snell-server]" >>${CONF} | |
echo "listen = 0.0.0.0:13254" >>${CONF} | |
echo "psk = ${PSK}" >>${CONF} | |
echo "obfs = tls" >>${CONF} | |
fi | |
if [ -f ${SYSTEMD} ]; then | |
echo "Found existing service..." | |
systemctl daemon-reload | |
systemctl restart snell | |
else | |
echo "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} | |
systemctl daemon-reload | |
systemctl enable snell | |
systemctl start snell | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment