update status check and bbr check

pull/171/head
233boy 6 years ago
parent e0ccf5bb97
commit 9806c42c94
  1. 11
      install.sh
  2. 7
      src/bbr.sh
  3. 4
      src/mtproto.sh
  4. 4
      src/socks.sh
  5. 4
      src/ss-info.sh
  6. 17
      src/status.sh
  7. 8
      src/v2ray-info.sh
  8. 74
      v2ray.sh

@ -872,6 +872,9 @@ config() {
systemctl restart v2ray
backup_config
## check status
_load status.sh
_check_status
}
backup_config() {
@ -955,8 +958,6 @@ show_config_info() {
_v2_args
_v2_info
_load ss-info.sh
_load status.sh
_check_status
}
_install() {
@ -991,13 +992,13 @@ _install() {
fi
fi
[[ $caddy ]] && install_caddy
get_ip
config
## bbr
_load bbr.sh
_open_bbr
_try_enable_bbr
get_ip
config
show_config_info
}

@ -4,14 +4,17 @@ _open_bbr() {
echo "net.ipv4.tcp_congestion_control = bbr" >>/etc/sysctl.conf
echo "net.core.default_qdisc = fq" >>/etc/sysctl.conf
sysctl -p >/dev/null 2>&1
echo
_green "..由于你的 VPS 内核支持开启 BBR ...已经为你启用 BBR 优化...."
echo
}
_kernel_ver() {
_try_enable_bbr() {
local _test1=$(uname -r | cut -d\. -f1)
local _test2=$(uname -r | cut -d\. -f2)
if [[ $_test1 -eq 4 && $_test2 -ge 9 ]] || [[ $_test1 -ge 5 ]]; then
_open_bbr
enable_bbr=true
fi
}
_kernel_ver

@ -6,6 +6,10 @@ _view_mtproto_info() {
fi
}
_mtproto_info() {
if [[ ! $v2ray_pid ]]; then
_load status.sh
_err_msg
fi
[[ -z $ip ]] && get_ip
echo
echo "---------- Telegram MTProto 配置信息 -------------"

@ -6,6 +6,10 @@ _view_socks_info() {
fi
}
_socks_info() {
if [[ ! $v2ray_pid ]]; then
_load status.sh
_err_msg
fi
[[ -z $ip ]] && get_ip
echo
echo "---------- Socks 配置信息 -------------"

@ -1,3 +1,7 @@
if [[ ! $v2ray_pid ]]; then
_load status.sh
_err_msg
fi
[[ -z $ip ]] && get_ip
if [[ $shadowsocks ]]; then
#local ss="ss://$(echo -n "${ssciphers}:${sspass}@${ip}:${ssport}" | base64 -w 0)#${_site}_ss_${ip}"

@ -1,10 +1,19 @@
_check_status() {
sleep 2
if [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then
_err_msg
fi
if [[ $v2ray_transport == [45] && $caddy ]] && [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then
_err_msg "Caddy"
fi
}
_err_msg() {
local str=$1
[[ -z $1 ]] && local str="V2Ray"
echo
_red "警告!!! V2Ray 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! V2Ray 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! V2Ray 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! $str 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! $str 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! $str 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
echo
fi
exit 1
}

@ -71,6 +71,13 @@ _v2_args() {
}
_v2_info() {
if [[ ! $v2ray_pid ]]; then
_load status.sh
_err_msg
elif [[ $v2ray_transport == [45] && $caddy ]] && [[ ! $caddy_pid ]]; then
_load status.sh
_err_msg "Caddy"
fi
[[ -z $ip ]] && get_ip
echo
echo
@ -132,7 +139,6 @@ _v2_info() {
echo " 备注: 广告拦截已开启.."
echo
fi
echo "---------- END -------------"
echo
echo "V2Ray 客户端使用教程: https://${_site}/post/4/"

@ -2318,34 +2318,30 @@ v2ray_service() {
done
}
start_v2ray() {
if [[ $v2ray_pid ]]; then
if [[ $v2ray_pid ]] || [[ $v2ray_transport == [45] && $caddy ]] && [[ $caddy_pid ]]; then
echo
echo -e "${green} V2Ray 正在运行...无需再启动$none"
echo
else
# systemctl start v2ray
service v2ray start >/dev/null 2>&1
systemctl start v2ray
if [[ $v2ray_transport == [45] && $caddy ]] && [[ ! $caddy_pid ]]; then
systemctl start caddy
fi
echo
echo '正在启动....'
echo
sleep 3
if [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then
echo
_red "警告!!! V2Ray 启动失败!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
echo
else
_load status.sh
_check_status
echo
_green " V2Ray 启动成功!!!!"
echo
fi
fi
}
stop_v2ray() {
if [[ $v2ray_pid ]]; then
# systemctl stop v2ray
service v2ray stop >/dev/null 2>&1
systemctl stop v2ray
echo
echo -e "${green} V2Ray 已停止$none"
echo
@ -2356,21 +2352,17 @@ stop_v2ray() {
fi
}
restart_v2ray() {
# systemctl restart v2ray
service v2ray restart >/dev/null 2>&1
systemctl restart v2ray
[[ $v2ray_transport == [45] && $caddy ]] && systemctl restart caddy
echo
echo '正在重启....'
echo
sleep 3
if [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then
echo
_red "警告!!! V2Ray 重启失败!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
echo
else
_load status.sh
_check_status
echo
_green " V2Ray 重启成功!!!!"
echo
fi
}
view_v2ray_log() {
echo
@ -2639,30 +2631,14 @@ other() {
install_bbr() {
local test1=$(sed -n '/net.ipv4.tcp_congestion_control/p' /etc/sysctl.conf)
local test2=$(sed -n '/net.core.default_qdisc/p' /etc/sysctl.conf)
if [[ $(uname -r | cut -b 1) -eq 4 ]]; then
case $(uname -r | cut -b 3-4) in
9. | [1-9][0-9])
if [[ $test1 == "net.ipv4.tcp_congestion_control = bbr" && $test2 == "net.core.default_qdisc = fq" ]]; then
local is_bbr=true
else
local try_enable_bbr=true
fi
;;
esac
fi
if [[ $is_bbr ]]; then
echo
echo -e "$green BBR 已经启用啦...无需再安装$none"
echo
elif [[ $try_enable_bbr ]]; then
_load bbr.sh
_open_bbr
echo
echo -e "$green ..由于你的 VPS 内核支持开启 BBR ...已经为你启用 BBR 优化....$none"
echo
else
# https://teddysun.com/489.html
bash <(curl -s -L https://github.com/teddysun/across/raw/master/bbr.sh)
_load bbr.sh
_try_enable_bbr
[[ ! $enable_bbr ]] && bash <(curl -s -L https://github.com/teddysun/across/raw/master/bbr.sh)
fi
}
install_lotserver() {
@ -2775,7 +2751,11 @@ config() {
[[ $(command -v apache2) ]] && apt-get remove apache2* -y >/dev/null 2>&1
fi
fi
do_service restart v2ray
systemctl restart v2ray
## check status
_load status.sh
_check_status
}
backup_config() {
_load backup.sh
@ -3010,21 +2990,15 @@ stop)
stop_v2ray
;;
restart)
[[ $v2ray_transport == [45] && $caddy ]] && do_service restart caddy
restart_v2ray
;;
reload)
config
[[ $v2ray_transport == [45] && $caddy ]] && caddy_config
if [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then
echo
_red "警告!!! V2Ray 加载失败!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
echo
else
config
echo
_green " V2Ray 加载成功!!! 如需查看 V2Ray 配置请使用 v2ray info"
echo
fi
;;
time)
_load sys-info.sh

Loading…
Cancel
Save