From 6f11dbeddf87f1e61496b74b9121d27e20cdf532 Mon Sep 17 00:00:00 2001 From: 233boy Date: Fri, 22 Feb 2019 14:44:25 +0800 Subject: [PATCH] update --- install.sh | 126 ++++++------------------------------- src/bbr.sh | 15 +++++ src/init.sh | 24 ++++++++ src/iptables.sh | 46 ++++++++++++++ src/uninstall.sh | 24 ++------ v2ray.sh | 157 ++--------------------------------------------- 6 files changed, 114 insertions(+), 278 deletions(-) create mode 100644 src/bbr.sh create mode 100644 src/iptables.sh diff --git a/install.sh b/install.sh index 4666d0e..d803655 100644 --- a/install.sh +++ b/install.sh @@ -693,12 +693,6 @@ install_info() { } domain_check() { - # if [[ $cmd == "yum" ]]; then - # yum install bind-utils -y - # else - # $cmd install dnsutils -y - # fi - # test_domain=$(dig $domain +short) test_domain=$(ping $domain -c 1 | grep -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}") if [[ $test_domain != $ip ]]; then echo @@ -726,8 +720,7 @@ caddy_config() { # local email=$(shuf -i1-10000000000 -n1) _load caddy-config.sh - # systemctl restart caddy - do_service restart caddy + systemctl restart caddy } install_v2ray() { @@ -782,71 +775,12 @@ install_v2ray() { } open_port() { - if [[ $cmd == "apt-get" ]]; then - if [[ $1 != "multiport" ]]; then - - iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT - iptables -I INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT - ip6tables -I INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT - ip6tables -I INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT - - # firewall-cmd --permanent --zone=public --add-port=$1/tcp - # firewall-cmd --permanent --zone=public --add-port=$1/udp - # firewall-cmd --reload - - else - - local multiport="${v2ray_dynamic_port_start_input}:${v2ray_dynamic_port_end_input}" - iptables -I INPUT -p tcp --match multiport --dports $multiport -j ACCEPT - iptables -I INPUT -p udp --match multiport --dports $multiport -j ACCEPT - ip6tables -I INPUT -p tcp --match multiport --dports $multiport -j ACCEPT - ip6tables -I INPUT -p udp --match multiport --dports $multiport -j ACCEPT - - # local multi_port="${v2ray_dynamic_port_start_input}-${v2ray_dynamic_port_end_input}" - # firewall-cmd --permanent --zone=public --add-port=$multi_port/tcp - # firewall-cmd --permanent --zone=public --add-port=$multi_port/udp - # firewall-cmd --reload - - fi - iptables-save >/etc/iptables.rules.v4 - ip6tables-save >/etc/iptables.rules.v6 - # else - # service iptables save >/dev/null 2>&1 - # service ip6tables save >/dev/null 2>&1 - fi + _load iptables.sh + _iptables_add $1 } del_port() { - if [[ $cmd == "apt-get" ]]; then - if [[ $1 != "multiport" ]]; then - # if [[ $cmd == "apt-get" ]]; then - iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT - iptables -D INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT - ip6tables -D INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT - ip6tables -D INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT - # else - # firewall-cmd --permanent --zone=public --remove-port=$1/tcp - # firewall-cmd --permanent --zone=public --remove-port=$1/udp - # fi - else - # if [[ $cmd == "apt-get" ]]; then - local ports="${v2ray_dynamicPort_start}:${v2ray_dynamicPort_end}" - iptables -D INPUT -p tcp --match multiport --dports $ports -j ACCEPT - iptables -D INPUT -p udp --match multiport --dports $ports -j ACCEPT - ip6tables -D INPUT -p tcp --match multiport --dports $ports -j ACCEPT - ip6tables -D INPUT -p udp --match multiport --dports $ports -j ACCEPT - # else - # local ports="${v2ray_dynamicPort_start}-${v2ray_dynamicPort_end}" - # firewall-cmd --permanent --zone=public --remove-port=$ports/tcp - # firewall-cmd --permanent --zone=public --remove-port=$ports/udp - # fi - fi - iptables-save >/etc/iptables.rules.v4 - ip6tables-save >/etc/iptables.rules.v6 - # else - # service iptables save >/dev/null 2>&1 - # service ip6tables save >/dev/null 2>&1 - fi - + _load iptables.sh + _iptables_del $1 } config() { @@ -863,22 +797,9 @@ config() { fi _load config.sh - if [[ $cmd == "apt-get" ]]; then - cat >/etc/network/if-pre-up.d/iptables <<-EOF -#!/bin/sh -/sbin/iptables-restore < /etc/iptables.rules.v4 -/sbin/ip6tables-restore < /etc/iptables.rules.v6 - EOF - chmod +x /etc/network/if-pre-up.d/iptables - # else - # [ $(pgrep "firewall") ] && systemctl stop firewalld - # systemctl mask firewalld - # systemctl disable firewalld - # systemctl enable iptables - # systemctl enable ip6tables - # systemctl start iptables - # systemctl start ip6tables - fi + ## save iptables rules + _load iptables.sh + _iptables_save [[ $shadowsocks ]] && open_port $ssport if [[ $v2ray_transport == [45] ]]; then @@ -891,8 +812,7 @@ config() { else open_port $v2ray_port fi - # systemctl restart v2ray - do_service restart v2ray + systemctl restart v2ray backup_config } @@ -914,20 +834,6 @@ backup_config() { fi } -try_enable_bbr() { - if [[ $(uname -r | cut -b 1) -eq 4 ]]; then - case $(uname -r | cut -b 3-4) in - 9. | [1-9][0-9]) - sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf - sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf - 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 - ;; - esac - fi -} - get_ip() { ip=$(curl -s https://ipinfo.io/ip) [[ -z $ip ]] && ip=$(curl -s https://api.ip.sb/ip) @@ -967,7 +873,7 @@ show_config_info() { } -install_233() { +_install() { if [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f $backup && -d /etc/v2ray/233boy/v2ray ]]; then echo echo " 大佬...你已经安装 V2Ray 啦...无需重新安装" @@ -987,7 +893,6 @@ install_233() { blocked_hosts shadowsocks_config install_info - try_enable_bbr # [[ $caddy ]] && domain_check install_v2ray if [[ $caddy || $v2ray_port == "80" ]]; then @@ -1002,10 +907,15 @@ install_233() { [[ $caddy ]] && install_caddy get_ip config + + ## bbr + _load bbr.sh + _open_bbr + show_config_info } -uninstall_233() { +_uninstall() { if [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f $backup && -d /etc/v2ray/233boy/v2ray ]]; then . $backup @@ -1076,11 +986,11 @@ while :; do read -p "$(echo -e "请选择 [${magenta}1-2$none]:")" choose case $choose in 1) - install_233 + _install break ;; 2) - uninstall_233 + _uninstall break ;; *) diff --git a/src/bbr.sh b/src/bbr.sh new file mode 100644 index 0000000..37d6c38 --- /dev/null +++ b/src/bbr.sh @@ -0,0 +1,15 @@ +_open_bbr() { + sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf + sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf + 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 +} + +if [[ $(uname -r | cut -b 1) -eq 4 ]]; then + case $(uname -r | cut -b 3-4) in + 9. | [1-9][0-9]) + _open_bbr + ;; + esac +fi diff --git a/src/init.sh b/src/init.sh index 079a9c3..34a38ab 100644 --- a/src/init.sh +++ b/src/init.sh @@ -14,4 +14,28 @@ _mkdir() { _load() { local _dir="/etc/v2ray/233boy/v2ray/src/" . "${_dir}$@" +} + +get_ip() { + ip=$(curl -s https://ipinfo.io/ip) + [[ -z $ip ]] && ip=$(curl -s https://api.ip.sb/ip) + [[ -z $ip ]] && ip=$(curl -s https://api.ipify.org) + [[ -z $ip ]] && ip=$(curl -s https://ip.seeip.org) + [[ -z $ip ]] && ip=$(curl -s https://ifconfig.co/ip) + [[ -z $ip ]] && ip=$(curl -s https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") + [[ -z $ip ]] && ip=$(curl -s icanhazip.com) + [[ -z $ip ]] && ip=$(curl -s myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") + [[ -z $ip ]] && echo -e "\n$red 这垃圾小鸡扔了吧!$none\n" && exit +} + +error() { + + echo -e "\n$red 输入错误!$none\n" + +} + +pause() { + + read -rsp "$(echo -e "按$green Enter 回车键 $none继续....或按$red Ctrl + C $none取消.")" -d $'\n' + echo } \ No newline at end of file diff --git a/src/iptables.sh b/src/iptables.sh new file mode 100644 index 0000000..f733ebe --- /dev/null +++ b/src/iptables.sh @@ -0,0 +1,46 @@ +_iptables_save() { + if [[ $cmd == "apt-get" && $(command -v iptables) ]]; then + cat >/etc/network/if-pre-up.d/iptables <<-EOF +#!/bin/sh +/sbin/iptables-restore < /etc/iptables.rules.v4 +/sbin/ip6tables-restore < /etc/iptables.rules.v6 + EOF + chmod +x /etc/network/if-pre-up.d/iptables + fi +} +_iptables_add() { + if [[ $cmd == "apt-get" && $(command -v iptables) ]]; then + if [[ $1 != "multiport" ]]; then + iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT + iptables -I INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT + ip6tables -I INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT + ip6tables -I INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT + else + local multiport="${v2ray_dynamic_port_start_input}:${v2ray_dynamic_port_end_input}" + iptables -I INPUT -p tcp --match multiport --dports $multiport -j ACCEPT + iptables -I INPUT -p udp --match multiport --dports $multiport -j ACCEPT + ip6tables -I INPUT -p tcp --match multiport --dports $multiport -j ACCEPT + ip6tables -I INPUT -p udp --match multiport --dports $multiport -j ACCEPT + fi + iptables-save >/etc/iptables.rules.v4 + ip6tables-save >/etc/iptables.rules.v6 + fi +} +_iptables_del() { + if [[ $cmd == "apt-get" && $(command -v iptables) ]]; then + if [[ $1 != "multiport" ]]; then + iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT + iptables -D INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT + ip6tables -D INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT + ip6tables -D INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT + else + local ports="${v2ray_dynamicPort_start}:${v2ray_dynamicPort_end}" + iptables -D INPUT -p tcp --match multiport --dports $ports -j ACCEPT + iptables -D INPUT -p udp --match multiport --dports $ports -j ACCEPT + ip6tables -D INPUT -p tcp --match multiport --dports $ports -j ACCEPT + ip6tables -D INPUT -p udp --match multiport --dports $ports -j ACCEPT + fi + iptables-save >/etc/iptables.rules.v4 + ip6tables-save >/etc/iptables.rules.v6 + fi +} diff --git a/src/uninstall.sh b/src/uninstall.sh index cb3989b..d7f93e3 100644 --- a/src/uninstall.sh +++ b/src/uninstall.sh @@ -79,19 +79,15 @@ if [[ $is_uninstall_v2ray && $is_uninstall_caddy ]]; then del_port $v2ray_port fi - [ $cmd == "apt-get" ] && rm -rf /etc/network/if-pre-up.d/iptables - - # [ $v2ray_pid ] && systemctl stop v2ray - [ $v2ray_pid ] && do_service stop v2ray + [[ $cmd == "apt-get" && $(command -v iptables) ]] && rm -rf /etc/network/if-pre-up.d/iptables + [ $v2ray_pid ] && systemctl stop v2ray rm -rf /usr/bin/v2ray rm -rf $_v2ray_sh rm -rf /etc/v2ray rm -rf /var/log/v2ray - # [ $caddy_pid ] && systemctl stop caddy - [ $caddy_pid ] && do_service stop caddy - + [ $caddy_pid ] && systemctl stop caddy rm -rf /usr/local/bin/caddy rm -rf /etc/caddy rm -rf /etc/ssl/caddy @@ -101,11 +97,6 @@ if [[ $is_uninstall_v2ray && $is_uninstall_caddy ]]; then rm -rf /lib/systemd/system/v2ray.service systemctl disable caddy >/dev/null 2>&1 rm -rf /lib/systemd/system/caddy.service - else - update-rc.d -f caddy remove >/dev/null 2>&1 - update-rc.d -f v2ray remove >/dev/null 2>&1 - rm -rf /etc/init.d/caddy - rm -rf /etc/init.d/v2ray fi # clear echo @@ -141,11 +132,9 @@ elif [[ $is_uninstall_v2ray ]]; then del_port $v2ray_port fi - [ $cmd == "apt-get" ] && rm -rf /etc/network/if-pre-up.d/iptables - - # [ $v2ray_pid ] && systemctl stop v2ray - [ $v2ray_pid ] && do_service stop v2ray + [[ $cmd == "apt-get" && $(command -v iptables) ]] && rm -rf /etc/network/if-pre-up.d/iptables + [ $v2ray_pid ] && systemctl stop v2ray rm -rf /usr/bin/v2ray rm -rf $_v2ray_sh rm -rf /etc/v2ray @@ -153,9 +142,6 @@ elif [[ $is_uninstall_v2ray ]]; then if [[ $systemd ]]; then systemctl disable v2ray >/dev/null 2>&1 rm -rf /lib/systemd/system/v2ray.service - else - update-rc.d -f v2ray remove >/dev/null 2>&1 - rm -rf /etc/init.d/v2ray fi # clear echo diff --git a/v2ray.sh b/v2ray.sh index 0063f8e..fb0fa35 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -226,23 +226,6 @@ get_shadowsocks_config_qr_link() { } -get_shadowsocks_config_qr_ask() { - echo - while :; do - echo -e "是否需要生成$yellow Shadowsocks 配置信息 $none二维码链接 [${magenta}Y/N$none]" - read -p "$(echo -e "默认 [${magenta}N$none]:")" y_n - [ -z $y_n ] && y_n="n" - if [[ $y_n == [Yy] ]]; then - get_shadowsocks_config_qr_link - break - elif [[ $y_n == [Nn] ]]; then - break - else - error - fi - done - -} change_shadowsocks_config() { if [[ $shadowsocks ]]; then @@ -321,7 +304,6 @@ shadowsocks_config() { config clear view_shadowsocks_config_info - # get_shadowsocks_config_qr_ask break elif [[ "$install_shadowsocks" == [Nn] ]]; then echo @@ -506,7 +488,6 @@ change_shadowsocks_port() { config clear view_shadowsocks_config_info - # get_shadowsocks_config_qr_ask break fi ;; @@ -547,7 +528,6 @@ change_shadowsocks_password() { config clear view_shadowsocks_config_info - # get_shadowsocks_config_qr_ask break ;; esac @@ -587,7 +567,6 @@ change_shadowsocks_ciphers() { config clear view_shadowsocks_config_info - # get_shadowsocks_config_qr_ask break ;; *) @@ -976,7 +955,6 @@ change_v2ray_port() { config clear view_v2ray_config_info - # download_v2ray_config_ask break fi ;; @@ -988,23 +966,6 @@ change_v2ray_port() { done fi -} -download_v2ray_config_ask() { - echo - while :; do - echo -e "是否需要 下载 V2Ray 配置 / 生成配置信息链接 / 生成二维码链接 [${magenta}Y/N$none]" - read -p "$(echo -e "默认 [${cyan}N$none]:")" y_n - [ -z $y_n ] && y_n="n" - if [[ $y_n == [Yy] ]]; then - download_v2ray_config - break - elif [[ $y_n == [Nn] ]]; then - break - else - error - fi - done - } change_v2ray_transport_ask() { echo @@ -1116,7 +1077,6 @@ change_v2ray_transport() { config clear view_v2ray_config_info - # download_v2ray_config_ask else old_transport backup_config v2ray_transport @@ -1124,7 +1084,6 @@ change_v2ray_transport() { config clear view_v2ray_config_info - # download_v2ray_config_ask fi } @@ -1229,7 +1188,6 @@ tls_config() { config clear view_v2ray_config_info - # download_v2ray_config_ask else if [[ $v2ray_transport_opt == 5 ]]; then path_config_ask @@ -1255,7 +1213,6 @@ tls_config() { caddy=true clear view_v2ray_config_info - # download_v2ray_config_ask else auto_tls_config fi @@ -1311,7 +1268,6 @@ auto_tls_config() { caddy=true clear view_v2ray_config_info - # download_v2ray_config_ask break elif [[ "$auto_install_caddy" == [Nn] ]]; then echo @@ -1332,7 +1288,6 @@ auto_tls_config() { config clear view_v2ray_config_info - # download_v2ray_config_ask break else error @@ -1733,7 +1688,6 @@ change_v2ray_id() { config clear view_v2ray_config_info - # download_v2ray_config_ask break elif [[ $y_n == [Nn] ]]; then echo @@ -1797,7 +1751,6 @@ change_domain() { config clear view_v2ray_config_info - # download_v2ray_config_ask break else error @@ -1859,7 +1812,6 @@ change_path_config() { config clear view_v2ray_config_info - # download_v2ray_config_ask elif [[ $v2ray_transport == [45] ]] && [[ $caddy ]]; then path_config_ask if [[ $new_path ]]; then @@ -1871,7 +1823,6 @@ change_path_config() { config clear view_v2ray_config_info - # download_v2ray_config_ask else echo echo @@ -1948,7 +1899,6 @@ change_proxy_site_config() { config clear view_v2ray_config_info - # download_v2ray_config_ask else echo echo @@ -2011,7 +1961,6 @@ disable_path() { config clear view_v2ray_config_info - # download_v2ray_config_ask break elif [[ "$y_n" == [Nn] ]]; then echo @@ -2147,7 +2096,6 @@ change_v2ray_alterId() { config clear view_v2ray_config_info - # download_v2ray_config_ask break ;; *) @@ -2191,7 +2139,6 @@ custom_uuid() { config clear view_v2ray_config_info - # download_v2ray_config_ask break ;; esac @@ -2600,11 +2547,8 @@ install_bbr() { echo -e "$green BBR 已经启用啦...无需再安装$none" echo elif [[ $try_enable_bbr ]]; then - sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf - sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf - 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 + _load bbr.sh + _open_bbr echo echo -e "$green ..由于你的 VPS 内核支持开启 BBR ...已经为你启用 BBR 优化....$none" echo @@ -2627,77 +2571,12 @@ uninstall_lotserver() { } open_port() { - if [[ $cmd == "apt-get" ]]; then - if [[ $1 != "multiport" ]]; then - # if [[ $cmd == "apt-get" ]]; then - iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT - iptables -I INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT - ip6tables -I INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT - ip6tables -I INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT - - # iptables-save >/etc/iptables.rules.v4 - # ip6tables-save >/etc/iptables.rules.v6 - # else - # firewall-cmd --permanent --zone=public --add-port=$1/tcp - # firewall-cmd --permanent --zone=public --add-port=$1/udp - # firewall-cmd --reload - # fi - else - # if [[ $cmd == "apt-get" ]]; then - local multiport="${v2ray_dynamic_port_start_input}:${v2ray_dynamic_port_end_input}" - iptables -I INPUT -p tcp --match multiport --dports $multiport -j ACCEPT - iptables -I INPUT -p udp --match multiport --dports $multiport -j ACCEPT - ip6tables -I INPUT -p tcp --match multiport --dports $multiport -j ACCEPT - ip6tables -I INPUT -p udp --match multiport --dports $multiport -j ACCEPT - - # iptables-save >/etc/iptables.rules.v4 - # ip6tables-save >/etc/iptables.rules.v6 - # else - # local multi_port="${v2ray_dynamic_port_start_input}-${v2ray_dynamic_port_end_input}" - # firewall-cmd --permanent --zone=public --add-port=$multi_port/tcp - # firewall-cmd --permanent --zone=public --add-port=$multi_port/udp - # firewall-cmd --reload - # fi - fi - iptables-save >/etc/iptables.rules.v4 - ip6tables-save >/etc/iptables.rules.v6 - # else - # service iptables save >/dev/null 2>&1 - # service ip6tables save >/dev/null 2>&1 - fi - + _load iptables.sh + _iptables_add $1 } del_port() { - if [[ $cmd == "apt-get" ]]; then - if [[ $1 != "multiport" ]]; then - # if [[ $cmd == "apt-get" ]]; then - iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT - iptables -D INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT - ip6tables -D INPUT -m state --state NEW -m tcp -p tcp --dport $1 -j ACCEPT - ip6tables -D INPUT -m state --state NEW -m udp -p udp --dport $1 -j ACCEPT - # else - # firewall-cmd --permanent --zone=public --remove-port=$1/tcp - # firewall-cmd --permanent --zone=public --remove-port=$1/udp - # fi - else - # if [[ $cmd == "apt-get" ]]; then - local ports="${v2ray_dynamicPort_start}:${v2ray_dynamicPort_end}" - iptables -D INPUT -p tcp --match multiport --dports $ports -j ACCEPT - iptables -D INPUT -p udp --match multiport --dports $ports -j ACCEPT - ip6tables -D INPUT -p tcp --match multiport --dports $ports -j ACCEPT - ip6tables -D INPUT -p udp --match multiport --dports $ports -j ACCEPT - # else - # local ports="${v2ray_dynamicPort_start}-${v2ray_dynamicPort_end}" - # firewall-cmd --permanent --zone=public --remove-port=$ports/tcp - # firewall-cmd --permanent --zone=public --remove-port=$ports/udp - # fi - fi - iptables-save >/etc/iptables.rules.v4 - ip6tables-save >/etc/iptables.rules.v6 - # else - # service iptables save >/dev/null 2>&1 - # service ip6tables save >/dev/null 2>&1 - fi + _load iptables.sh + _iptables_del $1 } update() { while :; do @@ -2882,29 +2761,6 @@ backup_config() { } -get_ip() { - ip=$(curl -s https://ipinfo.io/ip) - [[ -z $ip ]] && ip=$(curl -s https://api.ip.sb/ip) - [[ -z $ip ]] && ip=$(curl -s https://api.ipify.org) - [[ -z $ip ]] && ip=$(curl -s https://ip.seeip.org) - [[ -z $ip ]] && ip=$(curl -s https://ifconfig.co/ip) - [[ -z $ip ]] && ip=$(curl -s https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") - [[ -z $ip ]] && ip=$(curl -s icanhazip.com) - [[ -z $ip ]] && ip=$(curl -s myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") - [[ -z $ip ]] && echo -e "\n$red 这垃圾小鸡扔了吧!$none\n" && exit -} - -error() { - - echo -e "\n$red 输入错误!$none\n" - -} - -pause() { - - read -rsp "$(echo -e "按$green Enter 回车键 $none继续....或按$red Ctrl + C $none取消.")" -d $'\n' - echo -} do_service() { if [[ $systemd ]]; then systemctl $1 $2 @@ -3165,7 +3021,6 @@ reuuid) config clear view_v2ray_config_info - # download_v2ray_config_ask ;; v | version) echo