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 and OpenWRT routers, but i think it should work on any linux based platform with systemd/procd.
To download binaries run:
./install.sh <xray arch> <tun2socks arch>ex:
./install.sh mips32 mips-hardfloatCreate 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.client.json
Then copy the tun-xray directory to the router or device on which you want to run the proxy
scp -r tun-xray user@192.168.0.1:/opt/tun-xrayCreate symlinks for systemd services
ln -s /opt/tun-xray/xray.service /etc/systemd/system/xray.service
ln -s /opt/tun-xray/tun2socks.service /etc/systemd/system/tun2socks.serviceOr for proc.d on OpenWRT
ln -s /opt/tun-xray/xray.init /etc/init.d/xray
ln -s /opt/tun-xray/tun2socks.init /etc/init.d/tun2socksCreate users
useradd xray
useradd tun2socksStart services
systemctl start xray
systemctl start tun2socksOr
/etc/init.d/xray start
/etc/init.d/tun2socks startPut Xray config into tun-xray/xray_config.server.json
Then copy the tun-xray directory to the router or device on which you want to run the server
scp -r tun-xray user@192.168.0.1:/opt/tun-xrayCreate symlinks for systemd services
ln -s /opt/tun-xray/xray-server.service /etc/systemd/system/xray-server.serviceCreate user and update acess rights
useradd xray
chown -R xray:xray /opt/tun-xray