A lightweight SOCKS5 proxy that tunnels traffic through SSH connections. Available as both a standalone Go application and an Android app.
- SOCKS5 proxy server that works over SSH tunnels
- SSH authentication using password or private key
- Android app with persistent connection management
- Automatic reconnection on connection loss
- Nix package manager
- SSH key access to your server
- NekoBox app (for system-wide VPN on Android)
- Generate SSH key (if you don't have one):
ssh-keygen -t rsa -b 4096 -f ~/.ssh/google-france-key
- Copy public key to your server:
ssh-copy-id -i ~/.ssh/google-france-key.pub username@your_server
- Install Nix and direnv:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
- Set up the environment:
cd ssh2socks5
direnv allow
Or use:
nix develop
- Build:
For Android app:
make build-android
For standalone proxy:
make build-go
- Run the proxy:
make run
- or
nix run github:back2nix/ssh2socks5#ssh2socks5 -- -lport=1081 -host=35.193.63.104 -user=bg -key=/home/bg/Documents/code/backup/.ssh/google-france-key
- or
nix run .#ssh2socks5 -- -lport=1081 -host=35.193.63.104 -user=bg -key=/home/bg/Documents/code/backup/.ssh/google-france-key
sudo vim /etc/ssh/sshd_config
Найдите и измените/добавьте:
ClientAliveInterval 60
ClientAliveCountMax 2
TCPKeepAlive yes
# Для большего количества подключений
MaxStartups 100:30:200
MaxSessions 500
# Увеличиваем время на аутентификацию, чтобы меньше банило
LoginGraceTime 300
MaxAuthTries 300
# Отключаем DNS lookup для ускорения подключений
UseDNS no
Перезапустите SSH:
sudo systemctl restart ssh
Host hetzener_usa_d1
HostName 5.161.216.208
User root
IdentityFile /home/bg/.ssh/id_rsa
ControlMaster auto
ControlPath ~/.ssh/control-%r@%h:%p
ControlPersist 600
Configure your applications to use the SOCKS5 proxy at 127.0.0.1:1081
(default port).
- Install the SSH2SOCKS5 APK
- Enter your SSH server details and private key
- Start the proxy
Note: The app itself doesn't create a system-wide VPN. To route all device traffic through the proxy:
- Install NekoBox from F-Droid or Google Play
- Create a new SOCKS5 connection in NekoBox
- Configure it to connect to
127.0.0.1:1081
- Enable the VPN in NekoBox to route all device traffic through the proxy
MIT