Very simple set of scripts to use xray socks5 proxy as tun adapter and redirect all requests to specific ip list via socks5 proxy on router level.
I'm using it on Ubiquiti router, but i think it should work on any linux based platform with systemd.
To download binaries run:
./install.sh <xray arch> <tun2socks arch>
ex:
./install.sh mips32 mips-hardfloat
Create file 'tun-xray/iplist.txt' and add list of ips to pass through xray
You can specify both subnets and specific ips:
220.181.174.0/24
220.181.174.32
Put Xray config into tun-xray/xray_config.json
Then copy the tun-xray
directory to the router or device on which you want to run the proxy
scp -r tun-xray [email protected]:~/
Connect to the device and move the tun-xray
to /opt/tun-xray
.
Create symlinks for services
ln -s /opt/tun-xray/xray.service /etc/systemd/system/xray.service
ln -s /opt/tun-xray/tun2socks.service /etc/systemd/system/tun2socks.service
Create users
useradd xray
useradd tun2socks
Start services
systemctl start xray
systemctl start tun2socks