Skip to content

Instantly share code, notes, and snippets.

@SanariSan
Last active March 28, 2024 13:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SanariSan/0844c0cd009d76aefad456321e12b973 to your computer and use it in GitHub Desktop.
Save SanariSan/0844c0cd009d76aefad456321e12b973 to your computer and use it in GitHub Desktop.
Shadowsocks+V2Ray | client+server (autodeploy) setup (bash)

Shadow socks + V2Ray deployment/connection

Shoutout to this heroku deploy guide

Table of Contents

  • How to autodeploy proxy on heroku (repo)

  • How to setup linux pc to be able to connect (bash script)

  • How to setup windows pc to be able to connect

  • How to setup android phone to be able to connect

  • Useful links

Knowledge about coding is not needed unless you are using pc with linux.

How to setup linux pc

  1. Scroll down to find this bash script
  2. Fill config.json section with your server details
  3. Run, after it finishes you'll be able to connect through localhost:1080

Note, that you can create multiple config.json files with different names and run them on different ports simultaneously.

How to setup windows pc

  1. Download shadowsocks client, unzip it and place it's folder somewhere
  2. Download V2Ray, unzip it (7z works great with such extension)
  3. Rename executable from v2ray-plugin_windows_amd64.exe to v2ray.exe and move to shadosocks folder
  4. Launch shadowsocks, click on it's icon in tray, select servers -> scan qr or servers -> import url
  5. Enable proxying by checking System proxy -> Global
  6. Now all pc traffic goes through the proxy

How to setup android

  1. Download shadowsocks client from playmarket
  2. Download v2ray plugin from playmarket
  3. Open the app and scan qr/insert connection url, click connect
  4. Now all phone traffic goes through the proxy

Useful links

############
# HOW TO CONNECT FROM LINUX?
# HERE IS THE SCRIPT TO SETUP YOUR PC
############
#
sudo apt install -y shadowsocks-libev wget
sudo wget -O- "https://github.com/shadowsocks/v2ray-plugin/releases/download/v1.3.1/v2ray-plugin-linux-amd64-v1.3.1.tar.gz" | tar -zxv
sudo mv ./v2ray-plugin_linux_amd64 /usr/bin/v2ray
sudo chmod 777 /usr/bin/v2ray
sudo setcap 'cap_net_bind_service=+ep' /usr/bin/ss-local
sudo setcap 'cap_net_bind_service=+ep' /usr/bin/v2ray
sudo systemctl stop shadowsocks-libev.service
sudo systemctl disable shadowsocks-libev.service
sudo mkdir -p /etc/shadowsocks-libev
sudo bash -c 'cat <<EOT >/etc/shadowsocks-libev/config.json
{
"server":"your-app-name.herokuapp.com",
"server_port":443,
"local_port":1080,
"password":"pass",
"timeout":300,
"mode":"tcp_only",
"method":"chacha20-ietf-poly1305",
"fast_open":false,
"reuse_port":true,
"no_delay":true,
"plugin":"v2ray",
"plugin_opts":"tls;host=your-app-name.herokuapp.com;path=/v2ray_path_from_connection_details"
}
EOT
'
# Manual lauch:
# sudo ss-local -c /etc/shadowsocks-libev/config.json
# Now you can connect in browser
# Use socks5 + "Proxy DNS when using SOCKS v5" checkbox
############
# Auto start on boot
############
# This step could be skipped, file is here by default
# Just in case
sudo bash -c 'cat <<EOT >/usr/lib/systemd/system/shadowsocks-libev-local@.service
[Unit]
Description=Shadowsocks-Libev Custom Client Service for %I
Documentation=man:ss-local(1)
After=network-online.target
[Service]
DynamicUser=yes
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
ExecStart=/usr/bin/ss-local -c /etc/shadowsocks-libev/%i.json
[Install]
WantedBy=multi-user.target
EOT
'
sudo systemctl enable shadowsocks-libev-local@client
sudo systemctl start shadowsocks-libev-local@client
sudo systemctl status shadowsocks-libev-local@client
# To properly restart service after changes use all of these
# sudo systemctl stop shadowsocks-libev-local@client
# sudo systemctl disable shadowsocks-libev-local@client
# sudo systemctl daemon-reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment