pull/149/head
233boy 6 years ago committed by cutelua
parent f153daed3c
commit 6f11dbeddf
  1. 126
      install.sh
  2. 15
      src/bbr.sh
  3. 24
      src/init.sh
  4. 46
      src/iptables.sh
  5. 24
      src/uninstall.sh
  6. 157
      v2ray.sh

@ -693,12 +693,6 @@ install_info() {
} }
domain_check() { 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}") test_domain=$(ping $domain -c 1 | grep -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}")
if [[ $test_domain != $ip ]]; then if [[ $test_domain != $ip ]]; then
echo echo
@ -726,8 +720,7 @@ caddy_config() {
# local email=$(shuf -i1-10000000000 -n1) # local email=$(shuf -i1-10000000000 -n1)
_load caddy-config.sh _load caddy-config.sh
# systemctl restart caddy systemctl restart caddy
do_service restart caddy
} }
install_v2ray() { install_v2ray() {
@ -782,71 +775,12 @@ install_v2ray() {
} }
open_port() { open_port() {
if [[ $cmd == "apt-get" ]]; then _load iptables.sh
if [[ $1 != "multiport" ]]; then _iptables_add $1
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
} }
del_port() { del_port() {
if [[ $cmd == "apt-get" ]]; then _load iptables.sh
if [[ $1 != "multiport" ]]; then _iptables_del $1
# 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
} }
config() { config() {
@ -863,22 +797,9 @@ config() {
fi fi
_load config.sh _load config.sh
if [[ $cmd == "apt-get" ]]; then ## save iptables rules
cat >/etc/network/if-pre-up.d/iptables <<-EOF _load iptables.sh
#!/bin/sh _iptables_save
/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
[[ $shadowsocks ]] && open_port $ssport [[ $shadowsocks ]] && open_port $ssport
if [[ $v2ray_transport == [45] ]]; then if [[ $v2ray_transport == [45] ]]; then
@ -891,8 +812,7 @@ config() {
else else
open_port $v2ray_port open_port $v2ray_port
fi fi
# systemctl restart v2ray systemctl restart v2ray
do_service restart v2ray
backup_config backup_config
} }
@ -914,20 +834,6 @@ backup_config() {
fi 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() { get_ip() {
ip=$(curl -s https://ipinfo.io/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.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 if [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f $backup && -d /etc/v2ray/233boy/v2ray ]]; then
echo echo
echo " 大佬...你已经安装 V2Ray 啦...无需重新安装" echo " 大佬...你已经安装 V2Ray 啦...无需重新安装"
@ -987,7 +893,6 @@ install_233() {
blocked_hosts blocked_hosts
shadowsocks_config shadowsocks_config
install_info install_info
try_enable_bbr
# [[ $caddy ]] && domain_check # [[ $caddy ]] && domain_check
install_v2ray install_v2ray
if [[ $caddy || $v2ray_port == "80" ]]; then if [[ $caddy || $v2ray_port == "80" ]]; then
@ -1002,10 +907,15 @@ install_233() {
[[ $caddy ]] && install_caddy [[ $caddy ]] && install_caddy
get_ip get_ip
config config
## bbr
_load bbr.sh
_open_bbr
show_config_info 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 if [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f $backup && -d /etc/v2ray/233boy/v2ray ]]; then
. $backup . $backup
@ -1076,11 +986,11 @@ while :; do
read -p "$(echo -e "请选择 [${magenta}1-2$none]:")" choose read -p "$(echo -e "请选择 [${magenta}1-2$none]:")" choose
case $choose in case $choose in
1) 1)
install_233 _install
break break
;; ;;
2) 2)
uninstall_233 _uninstall
break break
;; ;;
*) *)

@ -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

@ -14,4 +14,28 @@ _mkdir() {
_load() { _load() {
local _dir="/etc/v2ray/233boy/v2ray/src/" local _dir="/etc/v2ray/233boy/v2ray/src/"
. "${_dir}$@" . "${_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
} }

@ -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
}

@ -79,19 +79,15 @@ if [[ $is_uninstall_v2ray && $is_uninstall_caddy ]]; then
del_port $v2ray_port del_port $v2ray_port
fi fi
[ $cmd == "apt-get" ] && rm -rf /etc/network/if-pre-up.d/iptables [[ $cmd == "apt-get" && $(command -v iptables) ]] && rm -rf /etc/network/if-pre-up.d/iptables
# [ $v2ray_pid ] && systemctl stop v2ray
[ $v2ray_pid ] && do_service stop v2ray
[ $v2ray_pid ] && systemctl stop v2ray
rm -rf /usr/bin/v2ray rm -rf /usr/bin/v2ray
rm -rf $_v2ray_sh rm -rf $_v2ray_sh
rm -rf /etc/v2ray rm -rf /etc/v2ray
rm -rf /var/log/v2ray rm -rf /var/log/v2ray
# [ $caddy_pid ] && systemctl stop caddy [ $caddy_pid ] && systemctl stop caddy
[ $caddy_pid ] && do_service stop caddy
rm -rf /usr/local/bin/caddy rm -rf /usr/local/bin/caddy
rm -rf /etc/caddy rm -rf /etc/caddy
rm -rf /etc/ssl/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 rm -rf /lib/systemd/system/v2ray.service
systemctl disable caddy >/dev/null 2>&1 systemctl disable caddy >/dev/null 2>&1
rm -rf /lib/systemd/system/caddy.service 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 fi
# clear # clear
echo echo
@ -141,11 +132,9 @@ elif [[ $is_uninstall_v2ray ]]; then
del_port $v2ray_port del_port $v2ray_port
fi fi
[ $cmd == "apt-get" ] && rm -rf /etc/network/if-pre-up.d/iptables [[ $cmd == "apt-get" && $(command -v iptables) ]] && rm -rf /etc/network/if-pre-up.d/iptables
# [ $v2ray_pid ] && systemctl stop v2ray
[ $v2ray_pid ] && do_service stop v2ray
[ $v2ray_pid ] && systemctl stop v2ray
rm -rf /usr/bin/v2ray rm -rf /usr/bin/v2ray
rm -rf $_v2ray_sh rm -rf $_v2ray_sh
rm -rf /etc/v2ray rm -rf /etc/v2ray
@ -153,9 +142,6 @@ elif [[ $is_uninstall_v2ray ]]; then
if [[ $systemd ]]; then if [[ $systemd ]]; then
systemctl disable v2ray >/dev/null 2>&1 systemctl disable v2ray >/dev/null 2>&1
rm -rf /lib/systemd/system/v2ray.service 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 fi
# clear # clear
echo echo

@ -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() { change_shadowsocks_config() {
if [[ $shadowsocks ]]; then if [[ $shadowsocks ]]; then
@ -321,7 +304,6 @@ shadowsocks_config() {
config config
clear clear
view_shadowsocks_config_info view_shadowsocks_config_info
# get_shadowsocks_config_qr_ask
break break
elif [[ "$install_shadowsocks" == [Nn] ]]; then elif [[ "$install_shadowsocks" == [Nn] ]]; then
echo echo
@ -506,7 +488,6 @@ change_shadowsocks_port() {
config config
clear clear
view_shadowsocks_config_info view_shadowsocks_config_info
# get_shadowsocks_config_qr_ask
break break
fi fi
;; ;;
@ -547,7 +528,6 @@ change_shadowsocks_password() {
config config
clear clear
view_shadowsocks_config_info view_shadowsocks_config_info
# get_shadowsocks_config_qr_ask
break break
;; ;;
esac esac
@ -587,7 +567,6 @@ change_shadowsocks_ciphers() {
config config
clear clear
view_shadowsocks_config_info view_shadowsocks_config_info
# get_shadowsocks_config_qr_ask
break break
;; ;;
*) *)
@ -976,7 +955,6 @@ change_v2ray_port() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
break break
fi fi
;; ;;
@ -988,23 +966,6 @@ change_v2ray_port() {
done done
fi 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() { change_v2ray_transport_ask() {
echo echo
@ -1116,7 +1077,6 @@ change_v2ray_transport() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
else else
old_transport old_transport
backup_config v2ray_transport backup_config v2ray_transport
@ -1124,7 +1084,6 @@ change_v2ray_transport() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
fi fi
} }
@ -1229,7 +1188,6 @@ tls_config() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
else else
if [[ $v2ray_transport_opt == 5 ]]; then if [[ $v2ray_transport_opt == 5 ]]; then
path_config_ask path_config_ask
@ -1255,7 +1213,6 @@ tls_config() {
caddy=true caddy=true
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
else else
auto_tls_config auto_tls_config
fi fi
@ -1311,7 +1268,6 @@ auto_tls_config() {
caddy=true caddy=true
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
break break
elif [[ "$auto_install_caddy" == [Nn] ]]; then elif [[ "$auto_install_caddy" == [Nn] ]]; then
echo echo
@ -1332,7 +1288,6 @@ auto_tls_config() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
break break
else else
error error
@ -1733,7 +1688,6 @@ change_v2ray_id() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
break break
elif [[ $y_n == [Nn] ]]; then elif [[ $y_n == [Nn] ]]; then
echo echo
@ -1797,7 +1751,6 @@ change_domain() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
break break
else else
error error
@ -1859,7 +1812,6 @@ change_path_config() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
elif [[ $v2ray_transport == [45] ]] && [[ $caddy ]]; then elif [[ $v2ray_transport == [45] ]] && [[ $caddy ]]; then
path_config_ask path_config_ask
if [[ $new_path ]]; then if [[ $new_path ]]; then
@ -1871,7 +1823,6 @@ change_path_config() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
else else
echo echo
echo echo
@ -1948,7 +1899,6 @@ change_proxy_site_config() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
else else
echo echo
echo echo
@ -2011,7 +1961,6 @@ disable_path() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
break break
elif [[ "$y_n" == [Nn] ]]; then elif [[ "$y_n" == [Nn] ]]; then
echo echo
@ -2147,7 +2096,6 @@ change_v2ray_alterId() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
break break
;; ;;
*) *)
@ -2191,7 +2139,6 @@ custom_uuid() {
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
break break
;; ;;
esac esac
@ -2600,11 +2547,8 @@ install_bbr() {
echo -e "$green BBR 已经启用啦...无需再安装$none" echo -e "$green BBR 已经启用啦...无需再安装$none"
echo echo
elif [[ $try_enable_bbr ]]; then elif [[ $try_enable_bbr ]]; then
sed -i '/net.ipv4.tcp_congestion_control/d' /etc/sysctl.conf _load bbr.sh
sed -i '/net.core.default_qdisc/d' /etc/sysctl.conf _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 echo
echo -e "$green ..由于你的 VPS 内核支持开启 BBR ...已经为你启用 BBR 优化....$none" echo -e "$green ..由于你的 VPS 内核支持开启 BBR ...已经为你启用 BBR 优化....$none"
echo echo
@ -2627,77 +2571,12 @@ uninstall_lotserver() {
} }
open_port() { open_port() {
if [[ $cmd == "apt-get" ]]; then _load iptables.sh
if [[ $1 != "multiport" ]]; then _iptables_add $1
# 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
} }
del_port() { del_port() {
if [[ $cmd == "apt-get" ]]; then _load iptables.sh
if [[ $1 != "multiport" ]]; then _iptables_del $1
# 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
} }
update() { update() {
while :; do 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() { do_service() {
if [[ $systemd ]]; then if [[ $systemd ]]; then
systemctl $1 $2 systemctl $1 $2
@ -3165,7 +3021,6 @@ reuuid)
config config
clear clear
view_v2ray_config_info view_v2ray_config_info
# download_v2ray_config_ask
;; ;;
v | version) v | version)
echo echo

Loading…
Cancel
Save