bc li 6a87dd2602 Add luci-app-v2ray.
按照大雕的 ssr 改了一个简化版的 v2ray 。。
支持的功能比较少。。只有基本款的 tcp/kcp/ws , tls/mux ,动态端口什么的没写
使用前需要把 v2ray 和 v2ctl 放在 /usr/bin/v2ray/ 目录下并 chmod +x
增加了 lua-cjson 和 ca-certificates 依赖,前者被 /etc/v2ray/gen_config.lua 用于生成 v2ray 的 json 配置文件, 后者用于 tls+ws 模式下的系统的证书
翻译可能不全,不过有些翻译了的话让人感到更奇怪。。(逃
2018-03-08 21:43:55 +08:00

27 lines
692 B
Bash
Executable File

#!/bin/sh
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
#GOOGLE=$(ping -4 www.gstatic.com -c 1 -w 5| sed '1{s/[^(]*(//;s/).*//;q}')
#iptables -t nat -I OUTPUT -p tcp -d $GOOGLE -j REDIRECT --to-port 7070
#sleep 3
/usr/bin/wget --spider --quiet --tries=1 --timeout=3 www.gstatic.com/generate_204
if [ "$?" == "0" ]; then
echo '['$LOGTIME'] V2Ray No Problem.'
else
/usr/bin/wget --spider --quiet --tries=1 --timeout=3 www.baidu.com
if [ "$?" == "0" ]; then
echo '['$LOGTIME'] Problem decteted, restarting V2Ray...'
/etc/init.d/v2raypro restart
else
echo '['$LOGTIME'] Network Problem. Do nothing.'
fi
fi
#sleep 3
#iptables -t nat -D OUTPUT -p tcp -d $GOOGLE -j REDIRECT --to-port 7070