This is a simple script that will route all traffic through xray using tun2socks tun adapter
- install xray using command " bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install "
- clone the repo into any directory ( git clone https://github.com/iamtrazy/xray-tun2socks )
- create a user named tun2socks - ( sudo useradd -m tun2socks )
- go to the directory xray-tun2socks
- edit the config.json file and paste your xray-client configuration ( do-not use dns name , instead use VPS ip address )
- set 10808 as socks5 inbound port in xray config
- run the tunnel.sh file ( sudo chmod +x tunnel.sh && sudo ./tunnel.sh )
- you can stop the script anytime by pressing ctrl+c
- after that you can easily excute script by "cd xray-tun2socks && sudo ./tunnel.sh"