@ -10,7 +10,7 @@ none='\e[0m'
# Root
# Root
[ [ $( id -u) != 0 ] ] && echo -e " 哎呀……请使用 ${ red } root ${ none } 用户运行 ${ yellow } ~(^_^) ${ none } " && exit 1
[ [ $( id -u) != 0 ] ] && echo -e " 哎呀……请使用 ${ red } root ${ none } 用户运行 ${ yellow } ~(^_^) ${ none } " && exit 1
_version = "v1.53 "
_version = "v2.01 "
cmd = "apt-get"
cmd = "apt-get"
@ -42,45 +42,41 @@ else
fi
fi
backup = "/etc/v2ray/233blog_v2ray_backup.txt"
backup = "/etc/v2ray/233blog_v2ray_backup.conf"
if [ [ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ] ] && [ [ -f $backup ] ] ; then
v2ray_transport = $( sed -n '17p' $backup )
v2ray_port = $( sed -n '19p' $backup )
v2ray_id = $( sed -n '21p' $backup )
v2ray_dynamicPort_start = $( sed -n '23p' $backup )
v2ray_dynamicPort_end = $( sed -n '25p' $backup )
domain = $( sed -n '27p' $backup )
caddy_status = $( sed -n '29p' $backup )
shadowsocks_status = $( sed -n '31p' $backup )
ssport = $( sed -n '33p' $backup )
sspass = $( sed -n '35p' $backup )
ssciphers = $( sed -n '37p' $backup )
blocked_ad_status = $( sed -n '39p' $backup )
ws_path_status = $( sed -n '41p' $backup )
ws_path = $( sed -n '43p' $backup )
if [ [ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ] ] && [ [ -f $backup && -d /etc/v2ray/233boy/v2ray ] ] ; then
. $backup
v2ray_ver = $( /usr/bin/v2ray/v2ray -version | head -n 1 | cut -d " " -f2)
v2ray_ver = $( /usr/bin/v2ray/v2ray -version | head -n 1 | cut -d " " -f2)
elif [ [ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ] ] && [ [ -f /etc/v2ray/233blog_v2ray_backup.txt && -d /etc/v2ray/233boy/v2ray ] ] ; then
cp -f /etc/v2ray/233boy/v2ray/v2ray.old.sh /usr/local/bin/v2ray
chmod +x /usr/local/bin/v2ray
echo
echo -e " 哇哦.. 出现了一点小意外.. 当前环境不能使用 $cyan v2.0 $none版本以上的管理脚本 .. 已自动回退到旧版本 "
echo
echo -e " 请使用命令 $yellow v2ray reload $none重新加载配置 ...以避免发生莫名其妙的问题 "
echo
exit 1
else
else
echo -e " 哎呀哎呀…… ${ red } 出错咯...请重新安装V2Ray ${ none } ${ yellow } ~(^_^) ${ none } " && exit 1
echo -e " 哎呀哎呀…… ${ red } 出错咯...请重新安装V2Ray ${ none } ${ yellow } ~(^_^) ${ none } " && exit 1
fi
fi
if [ [ $caddy_status = = "true" ] ] ; then
if [ [ $caddy_status ] ] ; then
caddy_installed = true
caddy_installed = true
fi
fi
if [ [ $shadowsocks_status = = "true" ] ] ; then
if [ [ $shadowsocks_status ] ] ; then
shadowsocks = true
shadowsocks = true
fi
fi
if [ [ $blocked_ad_status = = "true" ] ] ; then
if [ [ $blocked_ad_status ] ] ; then
is_blocked_ad = true
is_blocked_ad = true
fi
fi
if [ [ $v2ray_transport -ge 9 ] ] ; then
if [ [ $v2ray_transport -ge 9 ] ] ; then
dynamicPort = true
dynamicPort = true
port_range = " ${ v2ray_dynamicPort_start } - ${ v2ray_dynamicPort_end } "
port_range = " ${ v2ray_dynamicPort_start } - ${ v2ray_dynamicPort_end } "
fi
fi
if [ [ $ws_path_status = = "true" ] ] ; then
if [ [ $ws_path_status ] ] ; then
is_ws_path = true
is_ws_path = true
fi
fi
@ -96,6 +92,11 @@ if [ $v2ray_pid ]; then
else
else
v2ray_status = " $red未在运行 $none "
v2ray_status = " $red未在运行 $none "
fi
fi
if [ [ $v2ray_transport = = "4" && $caddy_installed ] ] && [ [ $caddy_pid ] ] ; then
caddy_run_status = " $green正在运行 $none "
else
caddy_run_status = " $red未在运行 $none "
fi
transport = (
transport = (
TCP
TCP
@ -182,7 +183,7 @@ create_vmess_URL_config() {
"add" : " ${ domain } " ,
"add" : " ${ domain } " ,
"port" : "443" ,
"port" : "443" ,
"id" : " ${ v2ray_id } " ,
"id" : " ${ v2ray_id } " ,
"aid" : "233 " ,
"aid" : " ${ alterId } " ,
"net" : "ws" ,
"net" : "ws" ,
"type" : "none" ,
"type" : "none" ,
"host" : " ${ host } " ,
"host" : " ${ host } " ,
@ -197,7 +198,7 @@ create_vmess_URL_config() {
"add" : " ${ ip } " ,
"add" : " ${ ip } " ,
"port" : " ${ v2ray_port } " ,
"port" : " ${ v2ray_port } " ,
"id" : " ${ v2ray_id } " ,
"id" : " ${ v2ray_id } " ,
"aid" : "233 " ,
"aid" : " ${ alterId } " ,
"net" : " ${ net } " ,
"net" : " ${ net } " ,
"type" : " ${ header } " ,
"type" : " ${ header } " ,
"host" : " ${ host } " ,
"host" : " ${ host } " ,
@ -225,7 +226,7 @@ view_v2ray_config_info() {
echo
echo
echo -e " $yellow 用户ID (User ID / UUID) = $cyan ${ v2ray_id } $none "
echo -e " $yellow 用户ID (User ID / UUID) = $cyan ${ v2ray_id } $none "
echo
echo
echo -e " $yellow 额外ID (Alter Id) = ${ cyan } 233 ${ none } "
echo -e " $yellow 额外ID (Alter Id) = ${ cyan } ${ alterId } ${ none } "
echo
echo
echo -e " $yellow 传输协议 (Network) = ${ cyan } ${ network } $none "
echo -e " $yellow 传输协议 (Network) = ${ cyan } ${ network } $none "
echo
echo
@ -252,7 +253,7 @@ view_v2ray_config_info() {
echo
echo
echo -e " $yellow 用户ID (User ID / UUID) = $cyan ${ v2ray_id } $none "
echo -e " $yellow 用户ID (User ID / UUID) = $cyan ${ v2ray_id } $none "
echo
echo
echo -e " $yellow 额外ID (Alter Id) = ${ cyan } 233 ${ none } "
echo -e " $yellow 额外ID (Alter Id) = ${ cyan } ${ alterId } ${ none } "
echo
echo
echo -e " $yellow 传输协议 (Network) = ${ cyan } ${ network } $none "
echo -e " $yellow 传输协议 (Network) = ${ cyan } ${ network } $none "
echo
echo
@ -477,17 +478,18 @@ shadowsocks_config() {
done
done
}
}
shadowsocks_port_config( ) {
shadowsocks_port_config( ) {
local random = $( shuf -i20001-65535 -n1)
while :; do
while :; do
echo -e "请输入 " $yellow "Shadowsocks" $none " 端口 [" $magenta "1-65535" $none "],不能和 " $yellow "V2ray" $none " 端口相同"
echo -e "请输入 " $yellow "Shadowsocks" $none " 端口 [" $magenta "1-65535" $none "],不能和 " $yellow "V2ray" $none " 端口相同"
read -p " $( echo -e " (默认端口: ${ cyan } 6666 $none ): " ) " new_ssport
read -p " $( echo -e " (默认端口: ${ cyan } ${ random } $none ): " ) " new_ssport
[ -z " $new_ssport " ] && new_ssport = "6666"
[ -z " $new_ssport " ] && new_ssport = $random
case $new_ssport in
case $new_ssport in
$v2ray_port )
$v2ray_port )
echo
echo
echo -e " 不能和 $cyan V2Ray 端口 $none一毛一样 .... "
echo -e " 不能和 $cyan V2Ray 端口 $none一毛一样 .... "
error
error
; ;
; ;
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | 6[ 0-4] [ 0-9] [ 0-9 ] [ 0-9] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $v2ray_transport = = "4" && $new_ssport = = "80" ] ] || [ [ $v2ray_transport = = "4" && $new_ssport = = "443" ] ] ; then
if [ [ $v2ray_transport = = "4" && $new_ssport = = "80" ] ] || [ [ $v2ray_transport = = "4" && $new_ssport = = "443" ] ] ; then
echo
echo
echo -e "由于你选择了 " $green "WebSocket + TLS" $none " 传输协议."
echo -e "由于你选择了 " $green "WebSocket + TLS" $none " 传输协议."
@ -529,9 +531,9 @@ shadowsocks_password_config() {
read -p " $( echo -e " (默认密码: ${ cyan } 233blog.com $none ) " ) : " new_sspass
read -p " $( echo -e " (默认密码: ${ cyan } 233blog.com $none ) " ) : " new_sspass
[ -z " $new_sspass " ] && new_sspass = "233blog.com"
[ -z " $new_sspass " ] && new_sspass = "233blog.com"
case $new_sspass in
case $new_sspass in
*/ *)
*[ /$] *)
echo
echo
echo -e " 由于这个脚本太辣鸡了..所以密码不能包括 $red / $none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以密码不能包含 $red / $none或 $red $ $none 这两 个符号 .... "
echo
echo
error
error
; ;
; ;
@ -596,7 +598,7 @@ change_shadowsocks_port() {
echo -e " 不能和 $cyan V2Ray 端口 $none一毛一样 .... "
echo -e " 不能和 $cyan V2Ray 端口 $none一毛一样 .... "
error
error
; ;
; ;
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | 6[ 0-4] [ 0-9] [ 0-9 ] [ 0-9] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $v2ray_transport = = "4" && $new_ssport = = "80" ] ] || [ [ $v2ray_transport = = "4" && $new_ssport = = "443" ] ] ; then
if [ [ $v2ray_transport = = "4" && $new_ssport = = "80" ] ] || [ [ $v2ray_transport = = "4" && $new_ssport = = "443" ] ] ; then
echo
echo
echo -e "由于你选择了 " $green "WebSocket + TLS" $none " 传输协议."
echo -e "由于你选择了 " $green "WebSocket + TLS" $none " 传输协议."
@ -620,7 +622,8 @@ change_shadowsocks_port() {
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
pause
pause
sed -i " 33s/ $ssport / $new_ssport / " $backup
# sed -i "45s/=$ssport/=$new_ssport/" $backup
backup_config ssport
del_port $ssport
del_port $ssport
open_port $new_ssport
open_port $new_ssport
ssport = $new_ssport
ssport = $new_ssport
@ -650,9 +653,9 @@ change_shadowsocks_password() {
echo " 跟当前密码一毛一样....修改个鸡鸡哦"
echo " 跟当前密码一毛一样....修改个鸡鸡哦"
error
error
; ;
; ;
*/ *)
*[ /$] *)
echo
echo
echo -e " 由于这个脚本太辣鸡了..所以密码不能包括 $red / $none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以密码不能包含 $red / $none或 $red $ $none 这两 个符号 .... "
echo
echo
error
error
; ;
; ;
@ -663,7 +666,8 @@ change_shadowsocks_password() {
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
pause
pause
sed -i " 35s/ $sspass / $new_sspass / " $backup
# sed -i "48s/=$sspass/=$new_sspass/" $backup
backup_config sspass
sspass = $new_sspass
sspass = $new_sspass
config
config
clear
clear
@ -680,7 +684,7 @@ change_shadowsocks_password() {
change_shadowsocks_ciphers( ) {
change_shadowsocks_ciphers( ) {
echo
echo
while :; do
while :; do
echo -e "请选择 " $yellow "Shadowsocks" $none " 加密协议 [ ${ magenta } 1-8 $none ] "
echo -e "请选择 " $yellow "Shadowsocks" $none " 加密协议 [ ${ magenta } 1- ${# ciphers [*] } $none ] "
for ( ( i = 1; i <= ${# ciphers [*] } ; i++) ) ; do
for ( ( i = 1; i <= ${# ciphers [*] } ; i++) ) ; do
ciphers_show = " ${ ciphers [ $i - 1] } "
ciphers_show = " ${ ciphers [ $i - 1] } "
echo
echo
@ -703,7 +707,8 @@ change_shadowsocks_ciphers() {
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
pause
pause
sed -i " 37s/ $ssciphers / $new_ssciphers / " $backup
# sed -i "51s/=$ssciphers/=$new_ssciphers/" $backup
backup_config ssciphers
ssciphers = $new_ssciphers
ssciphers = $new_ssciphers
config
config
clear
clear
@ -733,7 +738,8 @@ disable_shadowsocks() {
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
pause
pause
sed -i "31s/true/false/" $backup
# sed -i "31s/true/false/" $backup
backup_config -ss
del_port $ssport
del_port $ssport
shadowsocks = ''
shadowsocks = ''
config
config
@ -817,6 +823,10 @@ change_v2ray_config() {
blocked_hosts
blocked_hosts
break
break
; ;
; ;
[ Dd] | [ Aa] [ Ii] | 233 | 233[ Bb] [ Ll] [ Oo] [ Gg] | 233[ Bb] [ Ll] [ Oo] [ Gg] .[ Cc] [ Oo] [ Mm] | 233[ Bb] [ Oo] [ Yy] | [ Aa] [ Ll] [ Tt] [ Ee] [ Rr] [ Ii] [ Dd] )
change_v2ray_alterId
break
; ;
*)
*)
error
error
; ;
; ;
@ -844,7 +854,7 @@ change_v2ray_port() {
echo " 哎呀...跟当前端口一毛一样呀...修改个鸡鸡哦"
echo " 哎呀...跟当前端口一毛一样呀...修改个鸡鸡哦"
error
error
; ;
; ;
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | 6[ 0-4] [ 0-9] [ 0-9 ] [ 0-9] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $shadowsocks ] ] && [ [ $v2ray_port_opt = = $ssport ] ] ; then
if [ [ $shadowsocks ] ] && [ [ $v2ray_port_opt = = $ssport ] ] ; then
echo
echo
echo -e " ...不能跟 $cyan Shadowsocks 端口 $none一毛一样 ... "
echo -e " ...不能跟 $cyan Shadowsocks 端口 $none一毛一样 ... "
@ -867,7 +877,8 @@ change_v2ray_port() {
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
pause
pause
sed -i " 19s/ $v2ray_port / $v2ray_port_opt / " $backup
# sed -i "19s/$v2ray_port/$v2ray_port_opt/" $backup
backup_config v2ray_port
del_port $v2ray_port
del_port $v2ray_port
open_port $v2ray_port_opt
open_port $v2ray_port_opt
v2ray_port = $v2ray_port_opt
v2ray_port = $v2ray_port_opt
@ -923,7 +934,7 @@ change_v2ray_transport_ask() {
change_v2ray_transport( ) {
change_v2ray_transport( ) {
echo
echo
while :; do
while :; do
echo -e "请选择 " $yellow "V2Ray" $none " 传输协议 [ ${ magenta } 1-15 $none ] "
echo -e "请选择 " $yellow "V2Ray" $none " 传输协议 [ ${ magenta } 1- ${# transport [*] } $none ] "
echo
echo
for ( ( i = 1; i <= ${# transport [*] } ; i++) ) ; do
for ( ( i = 1; i <= ${# transport [*] } ; i++) ) ; do
Stream = " ${ transport [ $i - 1] } "
Stream = " ${ transport [ $i - 1] } "
@ -1013,13 +1024,15 @@ change_v2ray_transport() {
fi
fi
fi
fi
if [ [ $is_ws_path ] ] ; then
if [ [ $is_ws_path ] ] ; then
sed -i "41s/true/false/" $backup
# sed -i "41s/true/false/" $backup
backup_config -ws_path
fi
fi
elif [ [ $v2ray_transport -ge 9 ] ] ; then
elif [ [ $v2ray_transport -ge 9 ] ] ; then
del_port "multiport"
del_port "multiport"
fi
fi
open_port "multiport"
open_port "multiport"
sed -i " 17s/ $v2ray_transport / $v2ray_transport_opt /; 23s/ $v2ray_dynamicPort_start / $v2ray_dynamic_port_start_input /; 25s/ $v2ray_dynamicPort_end / $v2ray_dynamic_port_end_input / " $backup
# sed -i "17s/$v2ray_transport/$v2ray_transport_opt/; 23s/$v2ray_dynamicPort_start/$v2ray_dynamic_port_start_input/; 25s/$v2ray_dynamicPort_end/$v2ray_dynamic_port_end_input/" $backup
backup_config v2ray_transport v2ray_dynamicPort_start v2ray_dynamicPort_end
port_range = " ${ v2ray_dynamic_port_start_input } - ${ v2ray_dynamic_port_end_input } "
port_range = " ${ v2ray_dynamic_port_start_input } - ${ v2ray_dynamic_port_end_input } "
config
config
clear
clear
@ -1027,7 +1040,8 @@ change_v2ray_transport() {
view_v2ray_config_info
view_v2ray_config_info
download_v2ray_config_ask
download_v2ray_config_ask
else
else
sed -i " 17s/ $v2ray_transport / $v2ray_transport_opt / " $backup
# sed -i "17s/$v2ray_transport/$v2ray_transport_opt/" $backup
backup_config v2ray_transport
if [ [ $v2ray_transport = = 4 ] ] ; then
if [ [ $v2ray_transport = = 4 ] ] ; then
del_port "80"
del_port "80"
del_port "443"
del_port "443"
@ -1047,7 +1061,8 @@ change_v2ray_transport() {
fi
fi
fi
fi
if [ [ $is_ws_path ] ] ; then
if [ [ $is_ws_path ] ] ; then
sed -i "41s/true/false/" $backup
# sed -i "41s/true/false/" $backup
backup_config -ws_path
fi
fi
elif [ [ $v2ray_transport -ge 9 ] ] ; then
elif [ [ $v2ray_transport -ge 9 ] ] ; then
del_port "multiport"
del_port "multiport"
@ -1110,11 +1125,14 @@ ws_config() {
ws_path_config_ask
ws_path_config_ask
pause
pause
domain_check
domain_check
sed -i " 17s/ $v2ray_transport / $v2ray_transport_opt /; 27s/ $domain / $new_domain / " $backup
# sed -i "17s/$v2ray_transport/$v2ray_transport_opt/; 27s/$domain/$new_domain/" $backup
backup_config v2ray_transport domain
if [ [ $new_ws_path ] ] ; then
if [ [ $new_ws_path ] ] ; then
sed -i " 41s/false/true/; 43s/ $ws_path / $new_ws_path /; $ d " $backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
echo " $proxy_site " >>$backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path = $new_ws_path
ws_path = $new_ws_path
proxy_site = $new_proxy_site
is_ws_path = true
is_ws_path = true
fi
fi
@ -1165,11 +1183,14 @@ ws_config() {
ws_path_config_ask
ws_path_config_ask
pause
pause
domain_check
domain_check
sed -i " 17s/ $v2ray_transport / $v2ray_transport_opt /; 27s/ $domain / $new_domain /; 29s/false/true/ " $backup
# sed -i "17s/$v2ray_transport/$v2ray_transport_opt/; 27s/$domain/$new_domain/; 29s/false/true/" $backup
backup_config v2ray_transport domain caddy
if [ [ $new_ws_path ] ] ; then
if [ [ $new_ws_path ] ] ; then
sed -i " 41s/false/true/; 43s/ $ws_path / $new_ws_path /; $ d " $backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
echo " $proxy_site " >>$backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path = $new_ws_path
ws_path = $new_ws_path
proxy_site = $new_proxy_site
is_ws_path = true
is_ws_path = true
fi
fi
if [ [ $v2ray_transport -ge 9 ] ] ; then
if [ [ $v2ray_transport -ge 9 ] ] ; then
@ -1195,7 +1216,8 @@ ws_config() {
echo
echo
pause
pause
domain_check
domain_check
sed -i " 17s/ $v2ray_transport / $v2ray_transport_opt /; 27s/ $domain / $new_domain / " $backup
# sed -i "17s/$v2ray_transport/$v2ray_transport_opt/; 27s/$domain/$new_domain/" $backup
backup_config v2ray_transport domain
if [ [ $v2ray_transport -ge 9 ] ] ; then
if [ [ $v2ray_transport -ge 9 ] ] ; then
del_port "multiport"
del_port "multiport"
fi
fi
@ -1252,9 +1274,9 @@ ws_path_config() {
[ [ -z $new_ws_path ] ] && new_ws_path = "233blog"
[ [ -z $new_ws_path ] ] && new_ws_path = "233blog"
case $new_ws_path in
case $new_ws_path in
*/ *)
*[ /$] *)
echo
echo
echo -e " 由于这个脚本太辣鸡了..所以不能包含 $red / $none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以分流的路径 不能包含 $red / $none或 $red $ $none 这两 个符号 .... "
echo
echo
error
error
; ;
; ;
@ -1274,18 +1296,24 @@ proxy_site_config() {
echo
echo
while :; do
while :; do
echo -e " 请输入 ${ magenta } 一个正确的 $none ${ cyan } 网址 $none 用来作为 ${ cyan } 网站的伪装 $none , 例如 https://liyafly.com "
echo -e " 请输入 ${ magenta } 一个正确的 $none ${ cyan } 网址 $none 用来作为 ${ cyan } 网站的伪装 $none , 例如 https://liyafly.com "
echo -e " 举例...你当前的域名是 $green $domain $none , 伪装的网址的是 https://liyafly.com "
echo -e " 举例...假设 你当前的域名是 $green $domain $none , 伪装的网址的是 https://liyafly.com "
echo -e "然后打开你的域名时候...显示出来的内容就是来自 https://liyafly.com 的内容"
echo -e "然后打开你的域名时候...显示出来的内容就是来自 https://liyafly.com 的内容"
echo -e "其实就是一个反代...明白就好..."
echo -e "其实就是一个反代...明白就好..."
echo -e "如果不能伪装成功...可以使用 v2ray config 修改伪装的网址"
echo -e "如果不能伪装成功...可以使用 v2ray config 修改伪装的网址"
read -p " $( echo -e " (默认: [ ${ cyan } https://liyafly.com $none ]): " ) " proxy_site
read -p " $( echo -e " (默认: [ ${ cyan } https://liyafly.com $none ]): " ) " new_ proxy_site
[ [ -z $proxy_site ] ] && proxy_site = "https://liyafly.com"
[ [ -z $new_ proxy_site ] ] && new_ proxy_site= "https://liyafly.com"
case $proxy_site in
case $new_proxy_site in
*[ #$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以伪装的网址不能包含 $red # $none或 $red $ $none这两个符号 .... "
echo
error
; ;
*)
*)
echo
echo
echo
echo
echo -e " $yellow 伪装的网址 = ${ cyan } ${ proxy_site } $none "
echo -e " $yellow 伪装的网址 = ${ cyan } ${ new_ proxy_site} $none "
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
break
break
@ -1295,12 +1323,19 @@ proxy_site_config() {
}
}
install_caddy( ) {
install_caddy( ) {
if [ [ $cmd = = "yum" ] ] ; then
[ [ $( pgrep "httpd" ) ] ] && systemctl stop httpd
[ [ $( command -v httpd) ] ] && yum remove httpd -y
else
[ [ $( pgrep "apache2" ) ] ] && service apache2 stop
[ [ $( command -v apache2) ] ] && apt-get remove apache2* -y
fi
local caddy_tmp = "/tmp/install_caddy/"
local caddy_tmp = "/tmp/install_caddy/"
local caddy_tmp_file = "/tmp/install_caddy/caddy.tar.gz"
local caddy_tmp_file = "/tmp/install_caddy/caddy.tar.gz"
if [ [ $sys_bit = = "i386" || $sys_bit = = "i686" ] ] ; then
if [ [ $sys_bit = = "i386" || $sys_bit = = "i686" ] ] ; then
local caddy_download_link = "https://caddyserver.com/download/linux/386"
local caddy_download_link = "https://caddyserver.com/download/linux/386?license=personal "
elif [ [ $sys_bit = = "x86_64" ] ] ; then
elif [ [ $sys_bit = = "x86_64" ] ] ; then
local caddy_download_link = "https://caddyserver.com/download/linux/amd64"
local caddy_download_link = "https://caddyserver.com/download/linux/amd64?license=personal "
else
else
echo -e " $red 自动安装 Caddy 失败!不支持你的系统。 $none " && exit 1
echo -e " $red 自动安装 Caddy 失败!不支持你的系统。 $none " && exit 1
fi
fi
@ -1318,18 +1353,26 @@ install_caddy() {
echo -e " $red 安装 Caddy 出错! " && exit 1
echo -e " $red 安装 Caddy 出错! " && exit 1
fi
fi
setcap CAP_NET_BIND_SERVICE = +eip /usr/local/bin/caddy
if [ [ $systemd ] ] ; then
if [ [ $systemd ] ] ; then
cp -f ${ caddy_tmp } init/linux-systemd/caddy.service /lib/systemd/system/
cp -f ${ caddy_tmp } init/linux-systemd/caddy.service /lib/systemd/system/
sed -i "s/www-data/root/g" /lib/systemd/system/caddy.service
# sed -i "s/www-data/root/g" /lib/systemd/system/caddy.service
systemctl enable caddy
systemctl enable caddy
else
else
cp -f ${ caddy_tmp } init/linux-sysvinit/caddy /etc/init.d/caddy
cp -f ${ caddy_tmp } init/linux-sysvinit/caddy /etc/init.d/caddy
sed -i "s/www-data/root/g" /etc/init.d/caddy
# sed -i "s/www-data/root/g" /etc/init.d/caddy
chmod +x /etc/init.d/caddy
chmod +x /etc/init.d/caddy
update-rc.d -f caddy defaults
update-rc.d -f caddy defaults
fi
fi
mkdir -p /etc/ssl/caddy
mkdir -p /etc/ssl/caddy
if [ -z " $( grep www-data /etc/passwd) " ] ; then
useradd -M -s /usr/sbin/nologin www-data
fi
chown -R www-data.www-data /etc/ssl/caddy
mkdir -p /etc/caddy/
mkdir -p /etc/caddy/
rm -rf $caddy_tmp
rm -rf $caddy_tmp
@ -1337,11 +1380,12 @@ install_caddy() {
caddy_config( ) {
caddy_config( ) {
local email = $( shuf -i1-10000000000 -n1)
local email = $( shuf -i1-10000000000 -n1)
if [ [ $is_ws_path ] ] ; then
if [ [ $is_ws_path ] ] ; then
[ [ -z $proxy_site ] ] && proxy_site = $( sed '$!d' $backup )
# [[ -z $proxy_site ]] && proxy_site=$(sed '$!d' $backup )
cat >/etc/caddy/Caddyfile <<-EOF
cat >/etc/caddy/Caddyfile <<-EOF
$domain {
$domain {
tls ${ email } @gmail.com
tls ${ email } @gmail.com
gzip
gzip
timeouts none
proxy / $proxy_site {
proxy / $proxy_site {
without /${ ws_path }
without /${ ws_path }
}
}
@ -1355,6 +1399,7 @@ $domain {
cat >/etc/caddy/Caddyfile <<-EOF
cat >/etc/caddy/Caddyfile <<-EOF
$domain {
$domain {
tls ${ email } @gmail.com
tls ${ email } @gmail.com
timeouts none
proxy / 127.0.0.1:${ v2ray_port } {
proxy / 127.0.0.1:${ v2ray_port } {
websocket
websocket
}
}
@ -1377,7 +1422,7 @@ v2ray_dynamic_port_start() {
echo " 不能和 V2Ray 端口一毛一样...."
echo " 不能和 V2Ray 端口一毛一样...."
error
error
; ;
; ;
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | 6[ 0-4] [ 0-9] [ 0-9 ] [ 0-9] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $shadowsocks ] ] && [ [ $v2ray_dynamic_port_start_input = = $ssport ] ] ; then
if [ [ $shadowsocks ] ] && [ [ $v2ray_dynamic_port_start_input = = $ssport ] ] ; then
echo
echo
echo " 不能和 Shadowsocks 端口一毛一样...."
echo " 不能和 Shadowsocks 端口一毛一样...."
@ -1415,7 +1460,7 @@ v2ray_dynamic_port_end() {
read -p " $( echo -e " (默认结束端口: ${ cyan } 20000 $none ): " ) " v2ray_dynamic_port_end_input
read -p " $( echo -e " (默认结束端口: ${ cyan } 20000 $none ): " ) " v2ray_dynamic_port_end_input
[ -z $v2ray_dynamic_port_end_input ] && v2ray_dynamic_port_end_input = 20000
[ -z $v2ray_dynamic_port_end_input ] && v2ray_dynamic_port_end_input = 20000
case $v2ray_dynamic_port_end_input in
case $v2ray_dynamic_port_end_input in
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | 6[ 0-4] [ 0-9] [ 0-9 ] [ 0-9] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $v2ray_dynamic_port_end_input -le $v2ray_dynamic_port_start_input ] ] ; then
if [ [ $v2ray_dynamic_port_end_input -le $v2ray_dynamic_port_start_input ] ] ; then
echo
echo
@ -1457,12 +1502,13 @@ change_v2ray_dynamicport() {
pause
pause
del_port "multiport"
del_port "multiport"
open_port "multiport"
open_port "multiport"
sed -i " 23s/ $v2ray_dynamicPort_start / $v2ray_dynamic_port_start_input /; 25s/ $v2ray_dynamicPort_end / $v2ray_dynamic_port_end_input / " $backup
# sed -i "23s/$v2ray_dynamicPort_start/$v2ray_dynamic_port_start_input/; 25s/$v2ray_dynamicPort_end/$v2ray_dynamic_port_end_input/" $backup
backup_config v2ray_dynamicPort_start v2ray_dynamicPort_end
port_range = " ${ v2ray_dynamic_port_start_input } - ${ v2ray_dynamic_port_end_input } "
port_range = " ${ v2ray_dynamic_port_start_input } - ${ v2ray_dynamic_port_end_input } "
config
config
# clear
# clear
echo
echo
echo -e " $green 动态端口修改成功啦...你不需要修改 V2Ray 客户端配置...保持原有的配置即可... "
echo -e " $green 动态端口修改成功啦...你不需要修改 V2Ray 客户端配置...保持原有的配置即可... $none "
echo
echo
else
else
echo
echo
@ -1506,7 +1552,7 @@ change_v2ray_dynamic_port_start() {
echo " 不能和 V2Ray 端口一毛一样...."
echo " 不能和 V2Ray 端口一毛一样...."
error
error
; ;
; ;
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | 6[ 0-4] [ 0-9] [ 0-9 ] [ 0-9] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $shadowsocks ] ] && [ [ $v2ray_dynamic_port_start_input = = $ssport ] ] ; then
if [ [ $shadowsocks ] ] && [ [ $v2ray_dynamic_port_start_input = = $ssport ] ] ; then
echo
echo
echo " 不能和 Shadowsocks 端口一毛一样...."
echo " 不能和 Shadowsocks 端口一毛一样...."
@ -1544,7 +1590,7 @@ change_v2ray_dynamic_port_end() {
read -p " $( echo -e " (当前动态结束端口: ${ cyan } $v2ray_dynamicPort_end $none ): " ) " v2ray_dynamic_port_end_input
read -p " $( echo -e " (当前动态结束端口: ${ cyan } $v2ray_dynamicPort_end $none ): " ) " v2ray_dynamic_port_end_input
[ -z $v2ray_dynamic_port_end_input ] && error && continue
[ -z $v2ray_dynamic_port_end_input ] && error && continue
case $v2ray_dynamic_port_end_input in
case $v2ray_dynamic_port_end_input in
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | 6[ 0-4] [ 0-9] [ 0-9 ] [ 0-9] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $v2ray_dynamic_port_end_input -le $v2ray_dynamic_port_start_input ] ] ; then
if [ [ $v2ray_dynamic_port_end_input -le $v2ray_dynamic_port_start_input ] ] ; then
echo
echo
@ -1597,7 +1643,8 @@ change_v2ray_id() {
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
pause
pause
sed -i " 21s/ $v2ray_id / $uuid /; " $backup
# sed -i "21s/$v2ray_id/$uuid/;" $backup
backup_config uuid
v2ray_id = $uuid
v2ray_id = $uuid
config
config
clear
clear
@ -1659,7 +1706,8 @@ change_domain() {
echo
echo
pause
pause
domain_check
domain_check
sed -i " 27s/ $domain / $new_domain / " $backup
# sed -i "27s/$domain/$new_domain/" $backup
backup_config domain
domain = $new_domain
domain = $new_domain
caddy_config
caddy_config
config
config
@ -1704,9 +1752,9 @@ change_ws_path_config() {
echo
echo
error
error
; ;
; ;
*/ *)
*[ /$] *)
echo
echo
echo -e " 由于这个脚本太辣鸡了..所以不能包含 $red / $none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以分流的路径 不能包含 $red / $none或 $red $ $none 这两 个符号 .... "
echo
echo
error
error
; ;
; ;
@ -1721,7 +1769,8 @@ change_ws_path_config() {
esac
esac
done
done
pause
pause
sed -i " 43s/ $ws_path / $new_ws_path / " $backup
# sed -i "43s/$ws_path/$new_ws_path/" $backup
backup_config ws_path
ws_path = $new_ws_path
ws_path = $new_ws_path
caddy_config
caddy_config
config
config
@ -1731,9 +1780,11 @@ change_ws_path_config() {
elif [ [ $v2ray_transport = = 4 && $caddy_installed ] ] ; then
elif [ [ $v2ray_transport = = 4 && $caddy_installed ] ] ; then
ws_path_config_ask
ws_path_config_ask
if [ [ $new_ws_path ] ] ; then
if [ [ $new_ws_path ] ] ; then
sed -i " 41s/false/true/; 43s/ $ws_path / $new_ws_path /; $ d " $backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
echo " $proxy_site " >>$backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path = $new_ws_path
ws_path = $new_ws_path
proxy_site = $new_proxy_site
is_ws_path = true
is_ws_path = true
caddy_config
caddy_config
config
config
@ -1774,14 +1825,20 @@ change_proxy_site_config() {
echo -e "然后打开你的域名时候...显示出来的内容就是来自 https://liyafly.com 的内容"
echo -e "然后打开你的域名时候...显示出来的内容就是来自 https://liyafly.com 的内容"
echo -e "其实就是一个反代...明白就好..."
echo -e "其实就是一个反代...明白就好..."
echo -e "如果不能伪装成功...可以使用 v2ray config 修改伪装的网址"
echo -e "如果不能伪装成功...可以使用 v2ray config 修改伪装的网址"
read -p " $( echo -e " (当前伪装的网址: [ ${ cyan } $( sed '$!d' $backup ) $none ]): " ) " proxy_site
read -p " $( echo -e " (当前伪装的网址: [ ${ cyan } ${ proxy_site } $none ]): " ) " new_ proxy_site
[ [ -z $proxy_site ] ] && error && continue
[ [ -z $new_ proxy_site ] ] && error && continue
case $proxy_site in
case $new_proxy_site in
*[ #$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以伪装的网址不能包含 $red # $none或 $red $ $none这两个符号 .... "
echo
error
; ;
*)
*)
echo
echo
echo
echo
echo -e " $yellow 伪装的网址 = ${ cyan } ${ proxy_site } $none "
echo -e " $yellow 伪装的网址 = ${ cyan } ${ new_ proxy_site} $none "
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
break
break
@ -1789,8 +1846,10 @@ change_proxy_site_config() {
esac
esac
done
done
pause
pause
sed -i " $ d " $backup
# sed -i "$ d" $backup
echo " $proxy_site " >>$backup
# echo "$proxy_site" >>$backup
backup_config proxy_site
proxy_site = $new_proxy_site
caddy_config
caddy_config
echo
echo
echo
echo
@ -1802,9 +1861,11 @@ change_proxy_site_config() {
elif [ [ $v2ray_transport = = 4 && $caddy_installed ] ] ; then
elif [ [ $v2ray_transport = = 4 && $caddy_installed ] ] ; then
ws_path_config_ask
ws_path_config_ask
if [ [ $new_ws_path ] ] ; then
if [ [ $new_ws_path ] ] ; then
sed -i " 41s/false/true/; 43s/ $ws_path / $new_ws_path /; $ d " $backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
echo " $proxy_site " >>$backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path = $new_ws_path
ws_path = $new_ws_path
proxy_site = $new_proxy_site
is_ws_path = true
is_ws_path = true
caddy_config
caddy_config
config
config
@ -1838,7 +1899,7 @@ change_proxy_site_config() {
}
}
domain_check( ) {
domain_check( ) {
# test_domain=$(dig $new_domain +short)
# test_domain=$(dig $new_domain +short)
test_domain = $( ping $new_domain -c 1 | grep -oP -m1 "([ \d.]+ ){3}\d" )
test_domain = $( ping $new_domain -c 1 | grep -oP -m1 "(\d+\ .){3}\d+ " )
if [ [ $test_domain != $ip ] ] ; then
if [ [ $test_domain != $ip ] ] ; then
echo
echo
echo -e " $red 检测域名解析错误.... $none "
echo -e " $red 检测域名解析错误.... $none "
@ -1867,7 +1928,8 @@ disable_ws_path() {
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
pause
pause
sed -i "41s/true/false/" $backup
# sed -i "41s/true/false/" $backup
backup_config -ws_path
is_ws_path = ''
is_ws_path = ''
caddy_config
caddy_config
config
config
@ -1944,7 +2006,8 @@ blocked_hosts() {
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
pause
pause
sed -i "39s/false/true/" $backup
# sed -i "39s/false/true/" $backup
backup_config +ad
is_blocked_ad = true
is_blocked_ad = true
config
config
echo
echo
@ -1962,7 +2025,8 @@ blocked_hosts() {
echo "----------------------------------------------------------------"
echo "----------------------------------------------------------------"
echo
echo
pause
pause
sed -i "39s/true/false/" $backup
# sed -i "39s/true/false/" $backup
backup_config -ad
is_blocked_ad = ''
is_blocked_ad = ''
config
config
echo
echo
@ -1984,6 +2048,41 @@ blocked_hosts() {
done
done
}
}
change_v2ray_alterId( ) {
echo
while :; do
echo -e " 请输入 ${ yellow } alterId ${ none } 的数值 [ ${ magenta } 0-65535 $none ] "
read -p " $( echo -e " (当前数值是: ${ cyan } $alterId $none ): " ) " new_alterId
[ [ -z $new_alterId ] ] && error && continue
case $new_alterId in
$alterId )
echo
echo -e " 大佬...跟 当前 alterId 一毛一样啊...修改个鸡鸡哦 "
echo
error
; ;
[ 0-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | 6[ 0-4] [ 0-9] [ 0-9] [ 0-9] | 65[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
echo
echo
echo -e " $yellow alterId = $cyan $new_alterId $none "
echo "----------------------------------------------------------------"
echo
pause
# sed -i "45s/$alterId/$new_alterId/" $backup
backup_config alterId
alterId = $new_alterId
config
clear
view_v2ray_config_info
download_v2ray_config_ask
break
; ;
*)
error
; ;
esac
done
}
v2ray_service( ) {
v2ray_service( ) {
while :; do
while :; do
echo
echo
@ -2211,7 +2310,7 @@ create_v2ray_config_text() {
echo
echo
echo " 用户ID (User ID / UUID) = ${ v2ray_id } "
echo " 用户ID (User ID / UUID) = ${ v2ray_id } "
echo
echo
echo "额外ID (Alter Id) = 233 "
echo " 额外ID (Alter Id) = ${ alterId } "
echo
echo
echo " 传输协议 (Network) = ${ network } "
echo " 传输协议 (Network) = ${ network } "
echo
echo
@ -2238,7 +2337,7 @@ create_v2ray_config_text() {
echo
echo
echo " 用户ID (User ID / UUID) = ${ v2ray_id } "
echo " 用户ID (User ID / UUID) = ${ v2ray_id } "
echo
echo
echo "额外ID (Alter Id) = 233 "
echo " 额外ID (Alter Id) = ${ alterId } "
echo
echo
echo " 传输协议 (Network) = ${ network } "
echo " 传输协议 (Network) = ${ network } "
echo
echo
@ -2332,7 +2431,7 @@ get_v2ray_config_qr_link() {
if [ [ $ios_qr && $link3 ] ] ; then
if [ [ $ios_qr && $link3 ] ] ; then
echo -e " $yellow 适用于 Pepi / ShadowRay = $cyan ${ link3 } $none "
echo -e " $yellow 适用于 Pepi / ShadowRay = $cyan ${ link3 } $none "
echo
echo
echo " 请在 Pepi / ShadowRay 配置界面将 Alter Id 设置为 233 (如果你使用 Pepi / ShadowRay) "
echo " 请在 Pepi / ShadowRay 配置界面将 Alter Id 设置为 ${ alterId } (如果你使用 Pepi / ShadowRay) "
if [ [ $v2ray_transport = = 4 ] ] ; then
if [ [ $v2ray_transport = = 4 ] ] ; then
echo
echo
echo " 请在 Pepi / ShadowRay 配置界面打开 TLS (Enable TLS) (如果你使用 Pepi / ShadowRay)"
echo " 请在 Pepi / ShadowRay 配置界面打开 TLS (Enable TLS) (如果你使用 Pepi / ShadowRay)"
@ -2488,8 +2587,8 @@ open_port() {
iptables-save >/etc/iptables.rules.v4
iptables-save >/etc/iptables.rules.v4
ip6tables-save >/etc/iptables.rules.v6
ip6tables-save >/etc/iptables.rules.v6
else
else
service iptables save
service iptables save >/dev/null 2>& 1
service ip6tables save
service ip6tables save >/dev/null 2>& 1
fi
fi
}
}
@ -2521,8 +2620,8 @@ del_port() {
iptables-save >/etc/iptables.rules.v4
iptables-save >/etc/iptables.rules.v4
ip6tables-save >/etc/iptables.rules.v6
ip6tables-save >/etc/iptables.rules.v6
else
else
service iptables save
service iptables save >/dev/null 2>& 1
service ip6tables save
service ip6tables save >/dev/null 2>& 1
fi
fi
}
}
update( ) {
update( ) {
@ -2583,6 +2682,8 @@ update_v2ray() {
echo
echo
echo -e " $green 更新成功啦...当前 V2Ray 版本: ${ cyan } $v2ray_latest_ver $none "
echo -e " $green 更新成功啦...当前 V2Ray 版本: ${ cyan } $v2ray_latest_ver $none "
echo
echo
echo -e " $yellow 温馨提示: 为了避免出现莫名其妙的问题...所以客户端 V2Ray 版本最好也是: ${ cyan } $v2ray_latest_ver $none "
echo
rm -rf /tmp/v2ray
rm -rf /tmp/v2ray
else
else
echo
echo
@ -2720,7 +2821,7 @@ uninstall_v2ray() {
echo
echo
echo "如果你觉得这个脚本有哪些地方不够好的话...请告诉我"
echo "如果你觉得这个脚本有哪些地方不够好的话...请告诉我"
echo
echo
echo "反馈问题: https://github.com/233boy/v2ray/issus"
echo "反馈问题: https://github.com/233boy/v2ray/issue s"
echo
echo
elif [ [ $is_uninstall_v2ray ] ] ; then
elif [ [ $is_uninstall_v2ray ] ] ; then
@ -2764,7 +2865,7 @@ uninstall_v2ray() {
echo
echo
echo "如果你觉得这个脚本有哪些地方不够好的话...请告诉我"
echo "如果你觉得这个脚本有哪些地方不够好的话...请告诉我"
echo
echo
echo "反馈问题: https://github.com/233boy/v2ray/issus"
echo "反馈问题: https://github.com/233boy/v2ray/issue s"
echo
echo
fi
fi
}
}
@ -3346,10 +3447,10 @@ config() {
fi
fi
sed -i " 8s/2333/ $v2ray_port /; 14s/ $old_id / $v2ray_id / " $v2ray_server_config
sed -i " 8s/2333/ $v2ray_port /; 14s/ $old_id / $v2ray_id /; 16s/233/ $alterId / " $v2ray_server_config
if [ [ $v2ray_transport_opt -eq 4 || $v2ray_transport -eq 4 ] ] ; then
if [ [ $v2ray_transport_opt -eq 4 || $v2ray_transport -eq 4 ] ] ; then
sed -i " s/233blog.com/ $domain /; 22s/2333/443/; 25s/ $old_id / $v2ray_id / " $v2ray_client_config
sed -i " s/233blog.com/ $domain /; 22s/2333/443/; 25s/ $old_id / $v2ray_id /; 26s/233/ $alterId / " $v2ray_client_config
if [ [ $is_ws_path ] ] ; then
if [ [ $is_ws_path ] ] ; then
sed -i " 41s/233blog/ $ws_path / " $v2ray_client_config
sed -i " 41s/233blog/ $ws_path / " $v2ray_client_config
else
else
@ -3357,18 +3458,92 @@ config() {
fi
fi
else
else
[ [ -z $ip ] ] && get_ip
[ [ -z $ip ] ] && get_ip
sed -i " s/233blog.com/ $ip /; 22s/2333/ $v2ray_port /; 25s/ $old_id / $v2ray_id / " $v2ray_client_config
sed -i " s/233blog.com/ $ip /; 22s/2333/ $v2ray_port /; 25s/ $old_id / $v2ray_id /; 26s/233/ $alterId / " $v2ray_client_config
fi
fi
zip -q -r -j --password "233blog.com" /etc/v2ray/233blog_v2ray.zip $v2ray_client_config
zip -q -r -j --password "233blog.com" /etc/v2ray/233blog_v2ray.zip $v2ray_client_config
if [ [ $new_shadowsocks ] ] ; then
if [ [ $new_shadowsocks ] ] ; then
open_port $new_ssport
open_port $new_ssport
sed -i " 31s/false/true/; 33s/ $ssport / $new_ssport /; 35s/ $sspass / $new_sspass /; 37s/ $ssciphers / $new_ssciphers / " $backup
# sed -i "31s/false/true/; 33s/$ssport/$new_ssport/; 35s/$sspass/$new_sspass/; 37s/$ssciphers/$new_ssciphers/" $backup
backup_config +ss
fi
fi
if [ [ $v2ray_port = = "80" ] ] ; then
if [ [ $cmd = = "yum" ] ] ; then
[ [ $( pgrep "httpd" ) ] ] && systemctl stop httpd >/dev/null 2>& 1
[ [ $( command -v httpd) ] ] && yum remove httpd -y >/dev/null 2>& 1
else
[ [ $( pgrep "apache2" ) ] ] && service apache2 stop >/dev/null 2>& 1
[ [ $( command -v apache2) ] ] && apt-get remove apache2* -y >/dev/null 2>& 1
fi
fi
do_service restart v2ray
do_service restart v2ray
}
}
backup_config( ) {
for keys in $* ; do
case $keys in
v2ray_transport)
sed -i " 18s/= $v2ray_transport /= $v2ray_transport_opt / " $backup
; ;
v2ray_port)
sed -i " 21s/= $v2ray_port /= $v2ray_port_opt / " $backup
; ;
uuid)
sed -i " 24s/= $v2ray_id /= $uuid / " $backup
; ;
alterId)
sed -i " 27s/= $alterId /= $new_alterId / " $backup
; ;
v2ray_dynamicPort_start)
sed -i " 30s/= $v2ray_dynamicPort_start /= $v2ray_dynamic_port_start_input / " $backup
; ;
v2ray_dynamicPort_end)
sed -i " 33s/= $v2ray_dynamicPort_end /= $v2ray_dynamic_port_end_input / " $backup
; ;
domain)
sed -i " 36s/= $domain /= $new_domain / " $backup
; ;
caddy)
sed -i "39s/=/=true/" $backup
; ;
+ss)
sed -i " 42s/=/=true/; 45s/= $ssport /= $new_ssport /; 48s/= $sspass /= $new_sspass /; 51s/= $ssciphers /= $new_ssciphers / " $backup
; ;
-ss)
sed -i "42s/=true/=/" $backup
; ;
ssport)
sed -i " 45s/= $ssport /= $new_ssport / " $backup
; ;
sspass)
sed -i " 48s/= $sspass /= $new_sspass / " $backup
; ;
ssciphers)
sed -i " 51s/= $ssciphers /= $new_ssciphers / " $backup
; ;
+ad)
sed -i "54s/=/=true/" $backup
; ;
-ad)
sed -i "54s/=true/=/" $backup
; ;
+ws_path)
sed -i " 57s/=/=true/; 60s/= $ws_path /= $new_ws_path /; 63s#= $proxy_site #= $new_proxy_site # " $backup
; ;
-ws_path)
sed -i "57s/=true/=/" $backup
; ;
ws_path)
sed -i " 60s/= $ws_path /= $new_ws_path / " $backup
; ;
proxy_site)
sed -i " 63s#= $proxy_site #= $new_proxy_site # " $backup
; ;
esac
done
}
_boom_( ) {
_boom_( ) {
echo
echo
echo -e " $green ........... V2Ray 配置链接集合 by 233blog.com .......... $none "
echo -e " $green ........... V2Ray 配置链接集合 by 233blog.com .......... $none "
@ -3607,7 +3782,11 @@ Q | ssqr)
; ;
; ;
status)
status)
echo
echo
echo -e " V2Ray 状态: $v2ray_status "
if [ [ $v2ray_transport = = "4" && $caddy_installed ] ] ; then
echo -e " V2Ray 状态: $v2ray_status / Caddy 状态: $caddy_run_status "
else
echo -e " V2Ray 状态: $v2ray_status "
fi
echo
echo
; ;
; ;
start)
start)
@ -3617,8 +3796,16 @@ stop)
stop_v2ray
stop_v2ray
; ;
; ;
restart)
restart)
[ [ $v2ray_transport = = "4" && $caddy_installed ] ] && do_service restart caddy
restart_v2ray
restart_v2ray
; ;
; ;
reload)
config
[ [ $v2ray_transport = = "4" && $caddy_installed ] ] && caddy_config
clear
view_v2ray_config_info
download_v2ray_config_ask
; ;
log)
log)
view_v2ray_log
view_v2ray_log
; ;
; ;
@ -3638,6 +3825,11 @@ un | uninstall)
233 | 2333 | 233boy | 233blog | 233blog.com)
233 | 2333 | 233boy | 233blog | 233blog.com)
_boom_
_boom_
; ;
; ;
v | version)
echo
echo -e " 当前 V2Ray 版本: ${ green } $v2ray_ver $none / 当前 V2Ray 管理脚本版本: ${ cyan } $_version $none "
echo
; ;
bbr)
bbr)
other
other
; ;
; ;