Add v2ray
This commit is contained in:
12
trunk/user/v2ray/Makefile
Normal file
12
trunk/user/v2ray/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
all:
|
||||
|
||||
clean:
|
||||
|
||||
romfs:
|
||||
cp -a config.pb.gz $(ROMFSDIR)/etc_ro
|
||||
cp -a config.json $(ROMFSDIR)/etc_ro
|
||||
$(ROMFSINST) -S /usr/bin/chnroute.sh
|
||||
$(ROMFSINST) -S /usr/bin/v2ray
|
||||
$(ROMFSINST) -S /usr/bin/v2ctl
|
||||
$(ROMFSINST) -S /usr/bin/geoip.dat.gz
|
||||
$(ROMFSINST) -S /usr/bin/v2ray.sh
|
4742
trunk/user/v2ray/chnroute.sh
Normal file
4742
trunk/user/v2ray/chnroute.sh
Normal file
File diff suppressed because it is too large
Load Diff
118
trunk/user/v2ray/config.json
Normal file
118
trunk/user/v2ray/config.json
Normal file
@ -0,0 +1,118 @@
|
||||
{
|
||||
"inbounds": [
|
||||
{
|
||||
"port": 1080,
|
||||
"protocol": "socks",
|
||||
"settings": {
|
||||
"auth": "noauth",
|
||||
"udp": true,
|
||||
"userLevel": 8
|
||||
},
|
||||
"sniffing": {
|
||||
"destOverride": ["http", "tls"],
|
||||
"enabled": true
|
||||
},
|
||||
"tag": "socks"
|
||||
},
|
||||
{
|
||||
"listen": "0.0.0.0",
|
||||
"port": 1081,
|
||||
"protocol": "dokodemo-door",
|
||||
"sniffing": {
|
||||
"enabled": true,
|
||||
"destOverride": ["http", "tls"]
|
||||
},
|
||||
"settings": {
|
||||
"followRedirect": true,
|
||||
"network": "tcp,udp"
|
||||
}
|
||||
},
|
||||
{
|
||||
"listen": "0.0.0.0",
|
||||
"port": "8080",
|
||||
"protocol": "http",
|
||||
"settings": {
|
||||
"timeout": 120
|
||||
}
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"sendThrough": "0.0.0.0",
|
||||
"mux": {
|
||||
"enabled": false
|
||||
},
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"vnext": [
|
||||
{
|
||||
"address": "cc.kevin125.com",
|
||||
"port": 15246,
|
||||
"users": [{
|
||||
"alterId": 64,
|
||||
"id": "efef677f-331b-47e1-ed90-9f77b7c0da14",
|
||||
"level": 8,
|
||||
"security": "auto"
|
||||
}]
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "ws",
|
||||
"security": "tls",
|
||||
"tlssettings": {
|
||||
"allowInsecure": true,
|
||||
"serverName": ""
|
||||
},
|
||||
"wssettings": {
|
||||
"connectionReuse": true,
|
||||
"headers": {
|
||||
"Host": ""
|
||||
},
|
||||
"path": "/"
|
||||
}
|
||||
},
|
||||
"tag": "proxy"
|
||||
},
|
||||
{
|
||||
"protocol": "freedom",
|
||||
"settings": {},
|
||||
"streamSettings": {
|
||||
"sockopt": {
|
||||
"mark": 255
|
||||
}
|
||||
},
|
||||
"tag": "direct"
|
||||
},
|
||||
{
|
||||
"protocol": "blackhole",
|
||||
"settings": {
|
||||
"response": {
|
||||
"type": "http"
|
||||
}
|
||||
},
|
||||
"tag": "block"
|
||||
}
|
||||
],
|
||||
"dns": {
|
||||
"servers": ["8.8.8.8", "8.8.4.4", "localhost"]
|
||||
},
|
||||
"routing": {
|
||||
"strategy": "rules",
|
||||
"domainStrategy": "IPIfNonMatch",
|
||||
"settings": {
|
||||
"rules": [
|
||||
{
|
||||
"type": "field",
|
||||
"ip": ["geoip:private"],
|
||||
"outboundTag": "direct"
|
||||
},
|
||||
{
|
||||
"type": "field",
|
||||
"ip": ["geoip:cn"],
|
||||
"outboundTag": "direct"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
BIN
trunk/user/v2ray/config.pb.gz
Normal file
BIN
trunk/user/v2ray/config.pb.gz
Normal file
Binary file not shown.
BIN
trunk/user/v2ray/geoip.dat
Executable file
BIN
trunk/user/v2ray/geoip.dat
Executable file
Binary file not shown.
BIN
trunk/user/v2ray/geoip.dat.gz
Executable file
BIN
trunk/user/v2ray/geoip.dat.gz
Executable file
Binary file not shown.
BIN
trunk/user/v2ray/v2ctl
Executable file
BIN
trunk/user/v2ray/v2ctl
Executable file
Binary file not shown.
BIN
trunk/user/v2ray/v2ray
Executable file
BIN
trunk/user/v2ray/v2ray
Executable file
Binary file not shown.
105
trunk/user/v2ray/v2ray.sh
Executable file
105
trunk/user/v2ray/v2ray.sh
Executable file
@ -0,0 +1,105 @@
|
||||
#!/bin/sh
|
||||
|
||||
func_start(){
|
||||
logger -st "v2ray" "start"
|
||||
rm -f /tmp/config.pb.gz /tmp/config.pb
|
||||
cp -a /etc_ro/config.pb.gz /tmp && gunzip /tmp/config.pb.gz
|
||||
rm -f /tmp/geoip.dat.gz /tmp/geoip.dat
|
||||
cp -a /usr/bin/geoip.dat.gz /tmp && gunzip /tmp/geoip.dat.gz
|
||||
rm -f /tmp/v2ray && cp -a /usr/bin/v2ray /tmp
|
||||
cd /tmp && ./v2ray -format pb -config config.pb &
|
||||
}
|
||||
|
||||
func_stop(){
|
||||
logger -st "v2ray" "stop"
|
||||
killall v2ray
|
||||
}
|
||||
|
||||
func_istart(){
|
||||
logger -st "v2ray" "istart"
|
||||
|
||||
iptables -t nat -N V2RAY
|
||||
|
||||
iptables -t nat -A V2RAY -d 173.82.245.251/32 -j RETURN
|
||||
iptables -t nat -A V2RAY -d 173.82.140.9/32 -j RETURN
|
||||
|
||||
iptables -t nat -A V2RAY -d 0.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A V2RAY -d 10.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A V2RAY -d 127.0.0.0/8 -j RETURN
|
||||
iptables -t nat -A V2RAY -d 169.254.0.0/16 -j RETURN
|
||||
iptables -t nat -A V2RAY -d 172.16.0.0/16 -j RETURN
|
||||
iptables -t nat -A V2RAY -d 192.168.1.0/24 -j RETURN
|
||||
iptables -t nat -A V2RAY -d 224.0.0.0/4 -j RETURN
|
||||
iptables -t nat -A V2RAY -d 240.0.0.0/4 -j RETURN
|
||||
|
||||
iptables -t nat -A V2RAY -p tcp -m set --match-set chnroute dst -j RETURN
|
||||
iptables -t nat -A V2RAY -p icmp -m set --match-set chnroute dst -j RETURN
|
||||
|
||||
iptables -t nat -A V2RAY -p tcp -j RETURN -m mark --mark 0xff
|
||||
iptables -t nat -A V2RAY -p tcp -j REDIRECT --to-ports 1081
|
||||
|
||||
# apply redirect for traffic forworded by this proxy
|
||||
iptables -t nat -A PREROUTING -p tcp -j V2RAY
|
||||
# apply redirect for proxy itself
|
||||
iptables -t nat -A OUTPUT -p tcp -j V2RAY
|
||||
|
||||
# UDP Redirect
|
||||
iptables -t mangle -N V2RAY
|
||||
iptables -t mangle -A V2RAY -p udp -j RETURN -m mark --mark 0xff
|
||||
iptables -t mangle -A V2RAY -p udp --dport 53 -j TPROXY --on-port 1081 --tproxy-mark 0x01/0x01
|
||||
iptables -t mangle -N V2RAY_MARK
|
||||
iptables -t mangle -A V2RAY_MARK -p udp -j RETURN -m mark --mark 0xff
|
||||
iptables -t mangle -A V2RAY_MARK -p udp --dport 53 -j MARK --set-mark 1
|
||||
|
||||
# add route for udp traffic
|
||||
ip route add local default dev lo table 100
|
||||
ip rule add fwmark 1 lookup 100
|
||||
|
||||
# apply udp tproxy for traffic forworded by this proxy
|
||||
iptables -t mangle -A PREROUTING -j V2RAY
|
||||
# apply udp tproxy for proxy itself
|
||||
iptables -t mangle -A OUTPUT -j V2RAY_MARK
|
||||
}
|
||||
|
||||
func_istop(){
|
||||
logger -st "v2ray" "istop"
|
||||
|
||||
iptables -t nat -D PREROUTING -p tcp -j V2RAY
|
||||
iptables -t nat -D OUTPUT -p tcp -j V2RAY
|
||||
iptables -t nat -F V2RAY
|
||||
iptables -t nat -X V2RAY
|
||||
|
||||
iptables -t mangle -D PREROUTING -j V2RAY
|
||||
iptables -t mangle -F V2RAY
|
||||
iptables -t mangle -X V2RAY
|
||||
|
||||
iptables -t mangle -D OUTPUT -j V2RAY_MARK
|
||||
iptables -t mangle -F V2RAY_MARK
|
||||
iptables -t mangle -X V2RAY_MARK
|
||||
|
||||
ip rule del fwmark 1 lookup 100
|
||||
ip route del local default dev lo table 100
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
func_start
|
||||
;;
|
||||
stop)
|
||||
func_stop
|
||||
;;
|
||||
istart)
|
||||
func_istart
|
||||
;;
|
||||
istop)
|
||||
func_istop
|
||||
;;
|
||||
restart)
|
||||
func_stop
|
||||
func_start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 { start | stop | restart }"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
Reference in New Issue
Block a user