Merge pull request #1 from 233boy/master

sync 233boy's base
pull/31/head
cngzsunny 7 years ago committed by GitHub
commit 68793fd90b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 63
      config/backup.conf
  2. 47
      config/backup.txt
  3. 115
      config/client/h2.json
  4. 214
      install.sh
  5. 3699
      v2ray.old.sh
  6. 260
      v2ray.sh

@ -0,0 +1,63 @@
# -----------------------------------
# 警告...请不要修改或删除这个文件...谢谢
# 警告...请不要修改或删除这个文件...谢谢
# 警告...请不要修改或删除这个文件...谢谢
# -----------------------------------
# ---- 再次提醒 ----
# 大胸弟...如果你看到了这个...记得不要修改或更改这个文件
# ---- 说明 ----
# 嗯……这个文件呢,是用来备份一些设置的
# 我懒...不想用 JQ 去解析 JSON....
# 那就把 V2Ray 配置文件的一些重要参数提取出来
# 然后..在修改 V2Ray 配置的时候再重写一下就 OK 啦...
# 嗯…笨笨的方法
# ---- V2Ray 传输协议 -----
v2ray_transport=1
#---- V2Ray 端口 -----
v2ray_port=2333
#---- UUID -----
v2ray_id=23332333-2333-2333-2333-233boy233boy
#---- alterId -----
alterId=233
#---- V2Ray 动态端口开始 -----
v2ray_dynamicPort_start=10000
#---- V2Ray 动态端口结束 -----
v2ray_dynamicPort_end=20000
#---- 域名 -----
domain=233blog.com
#---- caddy -----
caddy_status=
#---- Shadowsocks -----
shadowsocks_status=
#---- Shadowsocks 端口 -----
ssport=6666
#---- Shadowsocks 密码 -----
sspass=233blog.com
#---- Shadowsocks 加密协议 -----
ssciphers=chacha20-ietf
#---- 屏蔽广告 -----
blocked_ad_status=
#---- 网站伪装 -----
ws_path_status=
#---- 伪装的路径 -----
ws_path=233blog
#---- 伪装的网址 -----
proxy_site=https://liyafly.com

@ -1,47 +0,0 @@
-----------------------------------
警告...请不要修改或删除这个文件...谢谢
警告...请不要修改或删除这个文件...谢谢
警告...请不要修改或删除这个文件...谢谢
-----------------------------------
---- 再次提醒 ----
大胸弟...如果你看到了这个...记得不要修改或更改这个文件
---- 说明 ----
嗯……这个文件呢,是用来备份一些设置的
我懒...不想用 JQ 去解析 JSON....
那就把 V2Ray 配置文件的一些重要参数提取出来
然后..在修改 V2Ray 配置的时候再重写一下就 OK 啦...
嗯…笨笨的方法
---- V2Ray 传输协议 -----
1
---- V2Ray 端口 -----
2333
---- UUID -----
23332333-2333-2333-2333-233boy233boy
---- V2Ray 动态端口开始 -----
10000
---- V2Ray 动态端口结束 -----
20000
---- 域名 -----
233blog.com
---- caddy -----
false
---- Shadowsocks -----
false
---- Shadowsocks 端口 -----
6666
---- Shadowsocks 密码 -----
233blog.com
---- Shadowsocks 加密协议 -----
chacha20-ietf
---- 屏蔽广告 -----
false
---- 网站伪装 -----
false
---- 伪装的路径 -----
233blog
---- alterId -----
233
---- 伪装的网址 -----
https://liyafly.com

@ -0,0 +1,115 @@
{
"log": {
"error": "error.log",
"loglevel": "warning"
},
"inbound": {
"port": 2333,
"listen": "127.0.0.1",
"protocol": "socks",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
},
"outbound": {
"protocol": "vmess",
"settings": {
"vnext": [
{
"address": "233blog.com",
"port": 2333,
"users": [
{
"id": "23332333-2333-2333-2333-233boy233boy",
"alterId": 233,
"security": "auto"
}
]
}
]
},
"streamSettings": {
"network": "h2",
"security": "tls",
"tlsSettings": {
"serverName": "233blog.com",
"allowInsecure": false
},
"httpSettings": {
"path": "/233blog"
}
},
"mux": {
"enabled": true
}
},
"inboundDetour": [
{
"port": 6666,
"listen": "127.0.0.1",
"protocol": "http",
"settings": {
"auth": "noauth",
"udp": true,
"ip": "127.0.0.1"
}
}
],
"outboundDetour": [
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
}
],
"dns": {
"servers": [
"8.8.8.8",
"8.8.4.4",
"localhost"
]
},
"routing": {
"strategy": "rules",
"settings": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"type": "field",
"ip": [
"0.0.0.0/8",
"10.0.0.0/8",
"100.64.0.0/10",
"127.0.0.0/8",
"169.254.0.0/16",
"172.16.0.0/12",
"192.0.0.0/24",
"192.0.2.0/24",
"192.168.0.0/16",
"198.18.0.0/15",
"198.51.100.0/24",
"203.0.113.0/24",
"::1/128",
"fc00::/7",
"fe80::/10",
"geoip:cn"
],
"domain": [
"geosite:cn"
],
"outboundTag": "direct"
},
{
"type": "chinasites",
"outboundTag": "direct"
},
{
"type": "chinaip",
"outboundTag": "direct"
}
]
}
}
}

@ -44,7 +44,7 @@ uuid=$(cat /proc/sys/kernel/random/uuid)
old_id="23332333-2333-2333-2333-233boy233boy" old_id="23332333-2333-2333-2333-233boy233boy"
v2ray_server_config="/etc/v2ray/config.json" v2ray_server_config="/etc/v2ray/config.json"
v2ray_client_config="/etc/v2ray/233blog_v2ray_config.json" v2ray_client_config="/etc/v2ray/233blog_v2ray_config.json"
backup="/etc/v2ray/233blog_v2ray_backup.txt" backup="/etc/v2ray/233blog_v2ray_backup.conf"
transport=( transport=(
TCP TCP
@ -394,9 +394,9 @@ ws_path_config() {
[[ -z $ws_path ]] && ws_path="233blog" [[ -z $ws_path ]] && ws_path="233blog"
case $ws_path in case $ws_path in
*/*) *[/$]*)
echo echo
echo -e " 由于这个脚本太辣鸡了..所以不能包含 $red/$none 这个符号.... " echo -e " 由于这个脚本太辣鸡了..所以分流的路径不能包含$red / $none$red $ $none个符号.... "
echo echo
error error
;; ;;
@ -424,6 +424,12 @@ proxy_site_config() {
[[ -z $proxy_site ]] && proxy_site="https://liyafly.com" [[ -z $proxy_site ]] && proxy_site="https://liyafly.com"
case $proxy_site in case $proxy_site in
*[#$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以伪装的网址不能包含$red # $none或$red $ $none这两个符号.... "
echo
error
;;
*) *)
echo echo
echo echo
@ -546,9 +552,9 @@ shadowsocks_password_config() {
read -p "$(echo -e "(默认密码: ${cyan}233blog.com$none)"): " sspass read -p "$(echo -e "(默认密码: ${cyan}233blog.com$none)"): " sspass
[ -z "$sspass" ] && sspass="233blog.com" [ -z "$sspass" ] && sspass="233blog.com"
case $sspass in case $sspass in
*/*) *[/$]*)
echo echo
echo -e " 由于这个脚本太辣鸡了..所以密码不能包含 $red/$none 这个符号.... " echo -e " 由于这个脚本太辣鸡了..所以密码不能包含$red / $none$red $ $none个符号.... "
echo echo
error error
;; ;;
@ -739,6 +745,7 @@ caddy_config() {
$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}
} }
@ -752,6 +759,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
} }
@ -1039,9 +1047,14 @@ del_port() {
# fi # fi
else else
# if [[ $cmd == "apt-get" ]]; then # if [[ $cmd == "apt-get" ]]; then
if [[ $v2ray_transport ]]; then
local ports="${v2ray_dynamicPort_start}:${v2ray_dynamicPort_end}"
else
local port_start=$(sed -n '23p' $backup) local port_start=$(sed -n '23p' $backup)
local port_end=$(sed -n '25p' $backup) local port_end=$(sed -n '25p' $backup)
local ports="${port_start}:${port_end}" local ports="${port_start}:${port_end}"
fi
iptables -D INPUT -p tcp --match multiport --dports $ports -j ACCEPT iptables -D INPUT -p tcp --match multiport --dports $ports -j ACCEPT
iptables -D INPUT -p udp --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 tcp --match multiport --dports $ports -j ACCEPT
@ -1068,7 +1081,7 @@ del_port() {
config() { config() {
cp -f $v2ray_server_config_file $v2ray_server_config cp -f $v2ray_server_config_file $v2ray_server_config
cp -f $v2ray_client_config_file $v2ray_client_config cp -f $v2ray_client_config_file $v2ray_client_config
cp -f /etc/v2ray/233boy/v2ray/config/backup.txt $backup cp -f /etc/v2ray/233boy/v2ray/config/backup.conf $backup
cp -f /etc/v2ray/233boy/v2ray/v2ray.sh /usr/local/bin/v2ray cp -f /etc/v2ray/233boy/v2ray/v2ray.sh /usr/local/bin/v2ray
chmod +x /usr/local/bin/v2ray chmod +x /usr/local/bin/v2ray
@ -1218,19 +1231,19 @@ config() {
} }
backup_config() { backup_config() {
sed -i "17s/1/$v2ray_transport_opt/; 19s/2333/$v2ray_port/; 21s/$old_id/$uuid/;" $backup sed -i "18s/=1/=$v2ray_transport_opt/; 21s/=2333/=$v2ray_port/; 24s/=$old_id/=$uuid/" $backup
if [ $v2ray_transport_opt -ge 9 ]; then if [ $v2ray_transport_opt -ge 9 ]; then
sed -i "23s/10000/$v2ray_dynamic_port_start_input/; 25s/20000/$v2ray_dynamic_port_end_input/" $backup sed -i "30s/=10000/=$v2ray_dynamic_port_start_input/; 33s/=20000/=$v2ray_dynamic_port_end_input/" $backup
fi fi
if [ $shadowsocks ]; then if [ $shadowsocks ]; then
sed -i "31s/false/true/; 33s/6666/$ssport/; 35s/233blog.com/$sspass/; 37s/chacha20-ietf/$ssciphers/" $backup sed -i "42s/=/=true/; 45s/=6666/=$ssport/; 48s/=233blog.com/=$sspass/; 51s/=chacha20-ietf/=$ssciphers/" $backup
fi fi
[ $v2ray_transport_opt == "4" ] && sed -i "27s/233blog.com/$domain/" $backup [ $v2ray_transport_opt == "4" ] && sed -i "36s/=233blog.com/=$domain/" $backup
[ $caddy ] && sed -i "29s/false/true/" $backup [ $caddy ] && sed -i "39s/=/=true/" $backup
[ $is_blocked_ad ] && sed -i "39s/false/true/" $backup [ $is_blocked_ad ] && sed -i "54s/=/=true/" $backup
if [[ $ws_path ]]; then if [[ $ws_path ]]; then
sed -i "41s/false/true/; 43s/233blog/$ws_path/; $ d" $backup sed -i "57s/=/=true/; 60s/=233blog/=$ws_path/" $backup
echo "$proxy_site" >>$backup sed -i "63s#=https://liyafly.com#=$proxy_site#" $backup
fi fi
} }
@ -1619,6 +1632,13 @@ install() {
echo -e " $yellow输入 ${cyan}v2ray${none} $yellow即可管理 V2Ray${none}" echo -e " $yellow输入 ${cyan}v2ray${none} $yellow即可管理 V2Ray${none}"
echo echo
exit 1 exit 1
elif [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f /etc/v2ray/233blog_v2ray_backup.txt && -d /etc/v2ray/233boy/v2ray ]]; then
echo
echo " 大佬... 如果你需要继续安装.. 请先卸载旧版本"
echo
echo -e " $yellow输入 ${cyan}v2ray uninstall${none} $yellow即可卸载${none}"
echo
exit 1
fi fi
v2ray_config v2ray_config
blocked_hosts blocked_hosts
@ -1645,6 +1665,168 @@ install() {
uninstall() { 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
while :; do
echo
read -p "$(echo -e "是否卸载 ${yellow}V2Ray$none [${magenta}Y/N$none]:")" uninstall_v2ray_ask
if [[ -z $uninstall_v2ray_ask ]]; then
error
else
case $uninstall_v2ray_ask in
Y | y)
is_uninstall_v2ray=true
echo
echo -e "$yellow 卸载 V2Ray = ${cyan}${none}"
echo
break
;;
N | n)
echo
echo -e "$red 卸载已取消...$none"
echo
break
;;
*)
error
;;
esac
fi
done
if [[ $caddy_status ]] && [[ -f /usr/local/bin/caddy && -f /etc/caddy/Caddyfile ]]; then
while :; do
echo
read -p "$(echo -e "是否卸载 ${yellow}Caddy$none [${magenta}Y/N$none]:")" uninstall_caddy_ask
if [[ -z $uninstall_caddy_ask ]]; then
error
else
case $uninstall_caddy_ask in
Y | y)
is_uninstall_caddy=true
echo
echo -e "$yellow 卸载 Caddy = ${cyan}${none}"
echo
break
;;
N | n)
echo
echo -e "$yellow 卸载 Caddy = ${cyan}${none}"
echo
break
;;
*)
error
;;
esac
fi
done
fi
if [[ $is_uninstall_v2ray && $is_uninstall_caddy ]]; then
pause
echo
if [[ $shadowsocks_status ]]; then
del_port $ssport
fi
if [[ $v2ray_transport == "4" ]]; then
del_port "80"
del_port "443"
del_port $v2ray_port
elif [[ $v2ray_transport -ge 9 ]]; then
del_port $v2ray_port
del_port "multiport"
else
del_port $v2ray_port
fi
[ $cmd == "apt-get" ] && rm -rf /etc/network/if-pre-up.d/iptables
v2ray_pid=$(ps ux | grep "/usr/bin/v2ray/v2ray" | grep -v grep | awk '{print $2}')
# [ $v2ray_pid ] && systemctl stop v2ray
[ $v2ray_pid ] && do_service stop v2ray
rm -rf /usr/bin/v2ray
rm -rf /usr/local/bin/v2ray
rm -rf /etc/v2ray
rm -rf /var/log/v2ray
caddy_pid=$(pgrep "caddy")
# [ $caddy_pid ] && systemctl stop caddy
[ $caddy_pid ] && do_service stop caddy
rm -rf /usr/local/bin/caddy
rm -rf /etc/caddy
rm -rf /etc/ssl/caddy
if [[ $systemd ]]; then
systemctl disable v2ray >/dev/null 2>&1
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
echo -e "$green V2Ray 卸载完成啦 ....$none"
echo
echo "如果你觉得这个脚本有哪些地方不够好的话...请告诉我"
echo
echo "反馈问题: https://github.com/233boy/v2ray/issus"
echo
elif [[ $is_uninstall_v2ray ]]; then
pause
echo
if [[ $shadowsocks_status ]]; then
del_port $ssport
fi
if [[ $v2ray_transport == "4" ]]; then
del_port "80"
del_port "443"
del_port $v2ray_port
elif [[ $v2ray_transport -ge 9 ]]; then
del_port $v2ray_port
del_port "multiport"
else
del_port $v2ray_port
fi
[ $cmd == "apt-get" ] && rm -rf /etc/network/if-pre-up.d/iptables
v2ray_pid=$(ps ux | grep "/usr/bin/v2ray/v2ray" | grep -v grep | awk '{print $2}')
# [ $v2ray_pid ] && systemctl stop v2ray
[ $v2ray_pid ] && do_service stop v2ray
rm -rf /usr/bin/v2ray
rm -rf /usr/local/bin/v2ray
rm -rf /etc/v2ray
rm -rf /var/log/v2ray
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
echo -e "$green V2Ray 卸载完成啦 ....$none"
echo
echo "如果你觉得这个脚本有哪些地方不够好的话...请告诉我"
echo
echo "反馈问题: https://github.com/233boy/v2ray/issus"
echo
fi
elif [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f /etc/v2ray/233blog_v2ray_backup.txt && -d /etc/v2ray/233boy/v2ray ]]; then
backup="/etc/v2ray/233blog_v2ray_backup.txt"
while :; do while :; do
echo echo
read -p "$(echo -e "是否卸载 ${yellow}V2Ray$none [${magenta}Y/N$none]:")" uninstall_v2ray_ask read -p "$(echo -e "是否卸载 ${yellow}V2Ray$none [${magenta}Y/N$none]:")" uninstall_v2ray_ask
@ -1821,7 +2003,7 @@ uninstall() {
echo -e " echo -e "
$red 大胸弟...你貌似毛有安装 V2Ray ....卸载个鸡鸡哦...$none $red 大胸弟...你貌似毛有安装 V2Ray ....卸载个鸡鸡哦...$none
备注...仅支持卸载使用我(233blog.com)提供的 V2Ray 一键安装脚本 备注...仅支持卸载使用我 (233blog.com) 提供的 V2Ray 一键安装脚本
" && exit 1 " && exit 1
fi fi
@ -1864,7 +2046,7 @@ while :; do
echo " 2. 卸载" echo " 2. 卸载"
echo echo
if [[ $local_install ]]; then if [[ $local_install ]]; then
echo " 温馨提示.. 本地安装已启用 .." echo -e "$yellow 温馨提示.. 本地安装已启用 ..$none"
echo echo
fi fi
read -p "$(echo -e "请选择 [${magenta}1-2$none]:")" choose read -p "$(echo -e "请选择 [${magenta}1-2$none]:")" choose

File diff suppressed because it is too large Load Diff

@ -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.68" _version="v2.01"
cmd="apt-get" cmd="apt-get"
@ -42,46 +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 && -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
v2ray_transport=$(sed -n '17p' $backup) . $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)
alterId=$(sed -n '45p' $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
@ -536,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
;; ;;
@ -627,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
@ -657,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
;; ;;
@ -670,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
@ -710,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
@ -740,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
@ -878,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
@ -1024,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
@ -1038,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"
@ -1058,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"
@ -1121,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
@ -1176,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
@ -1206,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
@ -1263,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
;; ;;
@ -1285,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
@ -1363,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}
} }
@ -1381,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
} }
@ -1483,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
@ -1623,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
@ -1685,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
@ -1730,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
;; ;;
@ -1747,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
@ -1757,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
@ -1800,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
@ -1815,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
@ -1828,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
@ -1893,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
@ -1970,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
@ -1988,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
@ -2013,18 +2051,25 @@ blocked_hosts() {
change_v2ray_alterId() { change_v2ray_alterId() {
echo echo
while :; do while :; do
echo -e "请输入 ${yellow}alterId${none} 的数值 [${magenta}1-65535$none]" echo -e "请输入 ${yellow}alterId${none} 的数值 [${magenta}0-65535$none]"
read -p "$(echo -e "(当前数值是: ${cyan}$alterId$none):") " new_alterId read -p "$(echo -e "(当前数值是: ${cyan}$alterId$none):") " new_alterId
[[ -z $new_alterId ]] && error && continue [[ -z $new_alterId ]] && error && continue
case $new_alterId in case $new_alterId 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] | 6[0-4][0-9][0-9][0-9] | 65[0-4][0-9][0-9] | 655[0-3][0-5]) $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 echo
echo -e "$yellow alterId = $cyan$new_alterId$none" echo -e "$yellow alterId = $cyan$new_alterId$none"
echo "----------------------------------------------------------------" echo "----------------------------------------------------------------"
echo echo
pause pause
sed -i "45s/$alterId/$new_alterId/" $backup # sed -i "45s/$alterId/$new_alterId/" $backup
backup_config alterId
alterId=$new_alterId alterId=$new_alterId
config config
clear clear
@ -3420,7 +3465,8 @@ 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 [[ $v2ray_port == "80" ]]; then
@ -3434,6 +3480,70 @@ config() {
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"
@ -3686,10 +3796,12 @@ stop)
stop_v2ray stop_v2ray
;; ;;
restart) restart)
[[ $v2ray_transport == "4" && $caddy_installed ]] && do_service restart caddy
restart_v2ray restart_v2ray
;; ;;
reload) reload)
config config
[[ $v2ray_transport == "4" && $caddy_installed ]] && caddy_config
clear clear
view_v2ray_config_info view_v2ray_config_info
download_v2ray_config_ask download_v2ray_config_ask

Loading…
Cancel
Save