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. 6
      src/ss-info.sh
  6. 19
      src/status.sh
  7. 8
      src/v2ray-info.sh
  8. 94
      v2ray.sh

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

@ -4,14 +4,17 @@ _open_bbr() {
echo "net.ipv4.tcp_congestion_control = bbr" >>/etc/sysctl.conf echo "net.ipv4.tcp_congestion_control = bbr" >>/etc/sysctl.conf
echo "net.core.default_qdisc = fq" >>/etc/sysctl.conf echo "net.core.default_qdisc = fq" >>/etc/sysctl.conf
sysctl -p >/dev/null 2>&1 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 _test1=$(uname -r | cut -d\. -f1)
local _test2=$(uname -r | cut -d\. -f2) local _test2=$(uname -r | cut -d\. -f2)
if [[ $_test1 -eq 4 && $_test2 -ge 9 ]] || [[ $_test1 -ge 5 ]]; then if [[ $_test1 -eq 4 && $_test2 -ge 9 ]] || [[ $_test1 -ge 5 ]]; then
_open_bbr _open_bbr
enable_bbr=true
fi fi
} }
_kernel_ver

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

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

@ -1,3 +1,7 @@
if [[ ! $v2ray_pid ]]; then
_load status.sh
_err_msg
fi
[[ -z $ip ]] && get_ip [[ -z $ip ]] && get_ip
if [[ $shadowsocks ]]; then if [[ $shadowsocks ]]; then
#local ss="ss://$(echo -n "${ssciphers}:${sspass}@${ip}:${ssport}" | base64 -w 0)#${_site}_ss_${ip}" #local ss="ss://$(echo -n "${ssciphers}:${sspass}@${ip}:${ssport}" | base64 -w 0)#${_site}_ss_${ip}"
@ -40,6 +44,6 @@ if [[ $shadowsocks ]]; then
echo -e "$yellow SS + V2ray - Plugin 链接 = ${cyan}${ssplugin}$none" echo -e "$yellow SS + V2ray - Plugin 链接 = ${cyan}${ssplugin}$none"
echo echo
fi fi
echo -e "提示: 输入$cyan v2ray ssqr $none可生成 Shadowsocks 二维码链接" echo -e "提示: 输入$cyan v2ray ssqr $none可生成 Shadowsocks 二维码链接"
echo echo
fi fi

@ -1,10 +1,19 @@
_check_status() { _check_status() {
sleep 2 sleep 2
if [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then if [[ ! $(pgrep -f /usr/bin/v2ray/v2ray) ]]; then
echo _err_msg
_red "警告!!! V2Ray 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! V2Ray 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! V2Ray 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
echo
fi 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 "警告!!! $str 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! $str 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
_red "警告!!! $str 运行出错!!!! 请检查端口是否冲突!!! 配置是否正确!!!!"
echo
exit 1
} }

@ -71,6 +71,13 @@ _v2_args() {
} }
_v2_info() { _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 [[ -z $ip ]] && get_ip
echo echo
echo echo
@ -132,7 +139,6 @@ _v2_info() {
echo " 备注: 广告拦截已开启.." echo " 备注: 广告拦截已开启.."
echo echo
fi fi
echo "---------- END -------------" echo "---------- END -------------"
echo echo
echo "V2Ray 客户端使用教程: https://${_site}/post/4/" echo "V2Ray 客户端使用教程: https://${_site}/post/4/"

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

Loading…
Cancel
Save