Merge pull request #1 from 233boy/master

更新
pull/35/head
harrygg 7 years ago committed by GitHub
commit 756d433e3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 63
      config/backup.conf
  2. 45
      config/backup.txt
  3. 115
      config/client/h2.json
  4. 328
      install.sh
  5. 3699
      v2ray.old.sh
  6. 402
      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,45 +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
---- 伪装的网址 -----
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"
v2ray_server_config="/etc/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=(
TCP
@ -78,7 +78,7 @@ v2ray_config() {
# clear
echo
while :; do
echo -e "请选择 "$yellow"V2Ray"$none" 传输协议 [${magenta}1-15$none]"
echo -e "请选择 "$yellow"V2Ray"$none" 传输协议 [${magenta}1-${#transport[*]}$none]"
echo
for ((i = 1; i <= ${#transport[*]}; i++)); do
Stream="${transport[$i - 1]}"
@ -114,12 +114,13 @@ v2ray_config() {
}
v2ray_port_config() {
if [[ $v2ray_transport_opt -ne 4 && $v2ray_transport_opt -lt 9 ]]; then
local random=$(shuf -i20001-65535 -n1)
while :; do
echo -e "请输入 "$yellow"V2Ray"$none" 端口 ["$magenta"1-65535"$none"]"
read -p "$(echo -e "(默认端口: ${cyan}2333$none):")" v2ray_port
[ -z "$v2ray_port" ] && v2ray_port="2333"
read -p "$(echo -e "(默认端口: ${cyan}${random}$none):")" v2ray_port
[ -z "$v2ray_port" ] && v2ray_port=$random
case $v2ray_port 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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
echo
echo
echo -e "$yellow V2Ray 端口 = $cyan$v2ray_port$none"
@ -147,13 +148,13 @@ v2ray_port_config() {
v2ray_dynamic_port_config() {
echo
local random=$(shuf -i20001-65535 -n1)
while :; do
echo -e "请输入 "$yellow"V2Ray"$none" 端口 ["$magenta"1-65535"$none"]"
read -p "$(echo -e "(默认端口: ${cyan}2333$none):")" v2ray_port
[ -z "$v2ray_port" ] && v2ray_port="2333"
read -p "$(echo -e "(默认端口: ${cyan}${random}$none):")" v2ray_port
[ -z "$v2ray_port" ] && v2ray_port=$random
case $v2ray_port 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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
echo
echo
echo -e "$yellow V2Ray 端口 = $cyan$v2ray_port$none"
@ -182,7 +183,7 @@ v2ray_dynamic_port_start() {
echo " 不能和 V2Ray 端口一毛一样...."
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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
echo
echo
echo -e "$yellow V2Ray 动态端口开始 = $cyan$v2ray_dynamic_port_start_input$none"
@ -210,7 +211,7 @@ v2ray_dynamic_port_end() {
read -p "$(echo -e "(默认结束端口: ${cyan}20000$none):")" v2ray_dynamic_port_end_input
[ -z $v2ray_dynamic_port_end_input ] && v2ray_dynamic_port_end_input=20000
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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
if [[ $v2ray_dynamic_port_end_input -le $v2ray_dynamic_port_start_input ]]; then
echo
@ -241,11 +242,11 @@ v2ray_dynamic_port_end() {
ws_config() {
echo
local random=$(shuf -i20001-65535 -n1)
while :; do
echo -e "请输入 "$yellow"V2Ray"$none" 端口 ["$magenta"1-65535"$none"],不能选择 "$magenta"80"$none" 或 "$magenta"443"$none" 端口"
read -p "$(echo -e "(默认端口: ${cyan}2333$none):")" v2ray_port
[ -z "$v2ray_port" ] && v2ray_port="2333"
read -p "$(echo -e "(默认端口: ${cyan}${random}$none):")" v2ray_port
[ -z "$v2ray_port" ] && v2ray_port=$random
case $v2ray_port in
80)
echo
@ -257,7 +258,7 @@ ws_config() {
echo " ..都说了不能选择 433 端口了咯....."
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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
echo
echo
echo -e "$yellow V2Ray 端口 = $cyan$v2ray_port$none"
@ -393,9 +394,9 @@ ws_path_config() {
[[ -z $ws_path ]] && ws_path="233blog"
case $ws_path in
*/*)
*[/$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以不能包含 $red/$none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以分流的路径不能包含$red / $none$red $ $none个符号.... "
echo
error
;;
@ -423,6 +424,12 @@ proxy_site_config() {
[[ -z $proxy_site ]] && proxy_site="https://liyafly.com"
case $proxy_site in
*[#$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以伪装的网址不能包含$red # $none或$red $ $none这两个符号.... "
echo
error
;;
*)
echo
echo
@ -492,17 +499,18 @@ shadowsocks_config() {
}
shadowsocks_port_config() {
local random=$(shuf -i20001-65535 -n1)
while :; do
echo -e "请输入 "$yellow"Shadowsocks"$none" 端口 ["$magenta"1-65535"$none"],不能和 "$yellow"V2Ray"$none" 端口相同"
read -p "$(echo -e "(默认端口: ${cyan}6666$none):") " ssport
[ -z "$ssport" ] && ssport="6666"
read -p "$(echo -e "(默认端口: ${cyan}${random}$none):") " ssport
[ -z "$ssport" ] && ssport=$random
case $ssport in
$v2ray_port)
echo
echo " 不能和 V2Ray 端口一毛一样...."
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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
if [[ $v2ray_transport_opt == "4" && $ssport == "80" ]] || [[ $v2ray_transport_opt == "4" && $ssport == "443" ]]; then
echo
echo -e "由于你选择了 "$green"WebSocket + TLS"$none" 传输协议."
@ -544,9 +552,9 @@ shadowsocks_password_config() {
read -p "$(echo -e "(默认密码: ${cyan}233blog.com$none)"): " sspass
[ -z "$sspass" ] && sspass="233blog.com"
case $sspass in
*/*)
*[/$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以密码不能包含 $red/$none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以密码不能包含$red / $none$red $ $none个符号.... "
echo
error
;;
@ -567,7 +575,7 @@ shadowsocks_password_config() {
shadowsocks_ciphers_config() {
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
ciphers_show="${ciphers[$i - 1]}"
echo
@ -666,7 +674,7 @@ domain_check() {
# $cmd install dnsutils -y
# fi
# test_domain=$(dig $domain +short)
test_domain=$(ping $domain -c 1 | grep -oP -m1 "([\d.]+){3}\d")
test_domain=$(ping $domain -c 1 | grep -oP -m1 "(\d+\.){3}\d+")
if [[ $test_domain != $ip ]]; then
echo
echo -e "$red 检测域名解析错误....$none"
@ -685,9 +693,9 @@ install_caddy() {
local caddy_tmp="/tmp/install_caddy/"
local caddy_tmp_file="/tmp/install_caddy/caddy.tar.gz"
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
local caddy_download_link="https://caddyserver.com/download/linux/amd64"
local caddy_download_link="https://caddyserver.com/download/linux/amd64?license=personal"
else
echo -e "$red 自动安装 Caddy 失败!不支持你的系统。$none" && exit 1
fi
@ -705,18 +713,26 @@ install_caddy() {
echo -e "$red 安装 Caddy 出错!" && exit 1
fi
setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/caddy
if [[ $systemd ]]; then
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
else
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
update-rc.d -f caddy defaults
fi
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/
rm -rf $caddy_tmp
caddy_config
@ -729,6 +745,7 @@ caddy_config() {
$domain {
tls ${email}@gmail.com
gzip
timeouts none
proxy / $proxy_site {
without /${ws_path}
}
@ -742,6 +759,7 @@ $domain {
cat >/etc/caddy/Caddyfile <<-EOF
$domain {
tls ${email}@gmail.com
timeouts none
proxy / 127.0.0.1:${v2ray_port} {
websocket
}
@ -755,13 +773,33 @@ $domain {
install_v2ray() {
$cmd update -y
# if [[ $cmd == "apt-get" ]]; then
# $cmd install -y lrzsz git zip unzip curl wget qrencode dnsutils
# else
# $cmd install -y lrzsz git zip unzip curl wget qrencode bind-utils iptables-services
# fi
if [[ $cmd == "apt-get" ]]; then
$cmd install -y lrzsz git zip unzip curl wget qrencode dnsutils
$cmd install -y lrzsz git zip unzip curl wget qrencode libcap2-bin
else
$cmd install -y lrzsz git zip unzip curl wget qrencode bind-utils iptables-services
$cmd install -y lrzsz git zip unzip curl wget qrencode libcap iptables-services
fi
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
if [[ $local_install ]]; then
if [[ ! -d $(pwd)/config ]]; then
echo
echo -e "$red 哎呀呀...安装失败了咯...$none"
echo
echo -e " 请确保你有完整的上传 233blog.com V2Ray 一键安装脚本 & 管理脚本到当前 ${green}$(pwd) $none目录下"
echo
exit 1
fi
mkdir -p /etc/v2ray/233boy/v2ray
cp -rf $(pwd)/* /etc/v2ray/233boy/v2ray
else
git clone https://github.com/233boy/v2ray /etc/v2ray/233boy/v2ray
fi
[ -d /tmp/v2ray ] && rm -rf /tmp/v2ray
mkdir -p /tmp/v2ray
@ -797,13 +835,6 @@ install_v2ray() {
rm -rf /tmp/v2ray
if [[ $local_install ]]; then
mkdir -p /etc/v2ray/233boy/v2ray
cp -rf $(pwd)/* /etc/v2ray/233boy/v2ray
else
git clone https://github.com/233boy/v2ray /etc/v2ray/233boy/v2ray
fi
if [ $shadowsocks ]; then
if [[ $is_blocked_ad ]]; then
case $v2ray_transport_opt in
@ -999,8 +1030,8 @@ open_port() {
iptables-save >/etc/iptables.rules.v4
ip6tables-save >/etc/iptables.rules.v6
else
service iptables save
service ip6tables save
service iptables save >/dev/null 2>&1
service ip6tables save >/dev/null 2>&1
fi
}
del_port() {
@ -1016,9 +1047,14 @@ del_port() {
# fi
else
# if [[ $cmd == "apt-get" ]]; then
local port_start=$(sed -n '23p' $backup)
local port_end=$(sed -n '25p' $backup)
local ports="${port_start}:${port_end}"
if [[ $v2ray_transport ]]; then
local ports="${v2ray_dynamicPort_start}:${v2ray_dynamicPort_end}"
else
local port_start=$(sed -n '23p' $backup)
local port_end=$(sed -n '25p' $backup)
local ports="${port_start}:${port_end}"
fi
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
@ -1036,8 +1072,8 @@ del_port() {
iptables-save >/etc/iptables.rules.v4
ip6tables-save >/etc/iptables.rules.v6
else
service iptables save
service ip6tables save
service iptables save >/dev/null 2>&1
service ip6tables save >/dev/null 2>&1
fi
}
@ -1045,7 +1081,7 @@ del_port() {
config() {
cp -f $v2ray_server_config_file $v2ray_server_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
chmod +x /usr/local/bin/v2ray
@ -1195,19 +1231,19 @@ 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
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
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
[ $v2ray_transport_opt == "4" ] && sed -i "27s/233blog.com/$domain/" $backup
[ $caddy ] && sed -i "29s/false/true/" $backup
[ $is_blocked_ad ] && sed -i "39s/false/true/" $backup
[ $v2ray_transport_opt == "4" ] && sed -i "36s/=233blog.com/=$domain/" $backup
[ $caddy ] && sed -i "39s/=/=true/" $backup
[ $is_blocked_ad ] && sed -i "54s/=/=true/" $backup
if [[ $ws_path ]]; then
sed -i "41s/false/true/; 43s/233blog/$ws_path/; $ d" $backup
echo "$proxy_site" >>$backup
sed -i "57s/=/=true/; 60s/=233blog/=$ws_path/" $backup
sed -i "63s#=https://liyafly.com#=$proxy_site#" $backup
fi
}
@ -1589,13 +1625,20 @@ get_qr_link() {
}
install() {
if [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f $backup && -f /lib/systemd/system/v2ray.service ]]; then
if [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f $backup && -d /etc/v2ray/233boy/v2ray ]]; then
echo
echo " 大佬...你已经安装 V2Ray 啦...无需重新安装"
echo
echo -e " $yellow输入 ${cyan}v2ray${none} $yellow即可管理 V2Ray${none}"
echo
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
v2ray_config
blocked_hosts
@ -1604,6 +1647,15 @@ install() {
try_enable_bbr
[ $caddy ] && domain_check
install_v2ray
if [[ $caddy || $v2ray_port == "80" ]]; then
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
fi
[ $caddy ] && install_caddy
get_ip
config
@ -1612,7 +1664,169 @@ install() {
}
uninstall() {
if [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f $backup ]]; 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
echo
read -p "$(echo -e "是否卸载 ${yellow}V2Ray$none [${magenta}Y/N$none]:")" uninstall_v2ray_ask
@ -1789,7 +2003,7 @@ uninstall() {
echo -e "
$red 大胸弟...你貌似毛有安装 V2Ray ....卸载个鸡鸡哦...$none
备注...仅支持卸载使用我(233blog.com)提供的 V2Ray 一键安装脚本
备注...仅支持卸载使用我 (233blog.com) 提供的 V2Ray 一键安装脚本
" && exit 1
fi
@ -1832,7 +2046,7 @@ while :; do
echo " 2. 卸载"
echo
if [[ $local_install ]]; then
echo " 温馨提示.. 本地安装已启用 .."
echo -e "$yellow 温馨提示.. 本地安装已启用 ..$none"
echo
fi
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
[[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1
_version="v1.53"
_version="v2.01"
cmd="apt-get"
@ -42,45 +42,41 @@ else
fi
backup="/etc/v2ray/233blog_v2ray_backup.txt"
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)
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
. $backup
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
echo -e " 哎呀哎呀…… ${red}出错咯...请重新安装V2Ray${none} ${yellow}~(^_^) ${none}" && exit 1
fi
if [[ $caddy_status == "true" ]]; then
if [[ $caddy_status ]]; then
caddy_installed=true
fi
if [[ $shadowsocks_status == "true" ]]; then
if [[ $shadowsocks_status ]]; then
shadowsocks=true
fi
if [[ $blocked_ad_status == "true" ]]; then
if [[ $blocked_ad_status ]]; then
is_blocked_ad=true
fi
if [[ $v2ray_transport -ge 9 ]]; then
dynamicPort=true
port_range="${v2ray_dynamicPort_start}-${v2ray_dynamicPort_end}"
fi
if [[ $ws_path_status == "true" ]]; then
if [[ $ws_path_status ]]; then
is_ws_path=true
fi
@ -96,6 +92,11 @@ if [ $v2ray_pid ]; then
else
v2ray_status="$red未在运行$none"
fi
if [[ $v2ray_transport == "4" && $caddy_installed ]] && [[ $caddy_pid ]]; then
caddy_run_status="$green正在运行$none"
else
caddy_run_status="$red未在运行$none"
fi
transport=(
TCP
@ -182,7 +183,7 @@ create_vmess_URL_config() {
"add": "${domain}",
"port": "443",
"id": "${v2ray_id}",
"aid": "233",
"aid": "${alterId}",
"net": "ws",
"type": "none",
"host": "${host}",
@ -197,7 +198,7 @@ create_vmess_URL_config() {
"add": "${ip}",
"port": "${v2ray_port}",
"id": "${v2ray_id}",
"aid": "233",
"aid": "${alterId}",
"net": "${net}",
"type": "${header}",
"host": "${host}",
@ -225,7 +226,7 @@ view_v2ray_config_info() {
echo
echo -e "$yellow 用户ID (User ID / UUID) = $cyan${v2ray_id}$none"
echo
echo -e "$yellow 额外ID (Alter Id) = ${cyan}233${none}"
echo -e "$yellow 额外ID (Alter Id) = ${cyan}${alterId}${none}"
echo
echo -e "$yellow 传输协议 (Network) = ${cyan}${network}$none"
echo
@ -252,7 +253,7 @@ view_v2ray_config_info() {
echo
echo -e "$yellow 用户ID (User ID / UUID) = $cyan${v2ray_id}$none"
echo
echo -e "$yellow 额外ID (Alter Id) = ${cyan}233${none}"
echo -e "$yellow 额外ID (Alter Id) = ${cyan}${alterId}${none}"
echo
echo -e "$yellow 传输协议 (Network) = ${cyan}${network}$none"
echo
@ -477,17 +478,18 @@ shadowsocks_config() {
done
}
shadowsocks_port_config() {
local random=$(shuf -i20001-65535 -n1)
while :; do
echo -e "请输入 "$yellow"Shadowsocks"$none" 端口 ["$magenta"1-65535"$none"],不能和 "$yellow"V2ray"$none" 端口相同"
read -p "$(echo -e "(默认端口: ${cyan}6666$none):") " new_ssport
[ -z "$new_ssport" ] && new_ssport="6666"
read -p "$(echo -e "(默认端口: ${cyan}${random}$none):") " new_ssport
[ -z "$new_ssport" ] && new_ssport=$random
case $new_ssport in
$v2ray_port)
echo
echo -e " 不能和$cyan V2Ray 端口 $none一毛一样...."
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] | 65[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
echo
echo -e "由于你选择了 "$green"WebSocket + TLS"$none" 传输协议."
@ -529,9 +531,9 @@ shadowsocks_password_config() {
read -p "$(echo -e "(默认密码: ${cyan}233blog.com$none)"): " new_sspass
[ -z "$new_sspass" ] && new_sspass="233blog.com"
case $new_sspass in
*/*)
*[/$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以密码不能包$red/$none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以密码不能包$red / $none$red $ $none个符号.... "
echo
error
;;
@ -596,7 +598,7 @@ change_shadowsocks_port() {
echo -e " 不能和$cyan V2Ray 端口 $none一毛一样...."
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] | 65[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
echo
echo -e "由于你选择了 "$green"WebSocket + TLS"$none" 传输协议."
@ -620,7 +622,8 @@ change_shadowsocks_port() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "33s/$ssport/$new_ssport/" $backup
# sed -i "45s/=$ssport/=$new_ssport/" $backup
backup_config ssport
del_port $ssport
open_port $new_ssport
ssport=$new_ssport
@ -650,9 +653,9 @@ change_shadowsocks_password() {
echo " 跟当前密码一毛一样....修改个鸡鸡哦"
error
;;
*/*)
*[/$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以密码不能包$red/$none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以密码不能包$red / $none$red $ $none个符号.... "
echo
error
;;
@ -663,7 +666,8 @@ change_shadowsocks_password() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "35s/$sspass/$new_sspass/" $backup
# sed -i "48s/=$sspass/=$new_sspass/" $backup
backup_config sspass
sspass=$new_sspass
config
clear
@ -680,7 +684,7 @@ change_shadowsocks_password() {
change_shadowsocks_ciphers() {
echo
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
ciphers_show="${ciphers[$i - 1]}"
echo
@ -703,7 +707,8 @@ change_shadowsocks_ciphers() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "37s/$ssciphers/$new_ssciphers/" $backup
# sed -i "51s/=$ssciphers/=$new_ssciphers/" $backup
backup_config ssciphers
ssciphers=$new_ssciphers
config
clear
@ -733,7 +738,8 @@ disable_shadowsocks() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "31s/true/false/" $backup
# sed -i "31s/true/false/" $backup
backup_config -ss
del_port $ssport
shadowsocks=''
config
@ -817,6 +823,10 @@ change_v2ray_config() {
blocked_hosts
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
;;
@ -844,7 +854,7 @@ change_v2ray_port() {
echo " 哎呀...跟当前端口一毛一样呀...修改个鸡鸡哦"
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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
if [[ $shadowsocks ]] && [[ $v2ray_port_opt == $ssport ]]; then
echo
echo -e " ...不能跟$cyan Shadowsocks 端口 $none一毛一样..."
@ -867,7 +877,8 @@ change_v2ray_port() {
echo "----------------------------------------------------------------"
echo
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
open_port $v2ray_port_opt
v2ray_port=$v2ray_port_opt
@ -923,7 +934,7 @@ change_v2ray_transport_ask() {
change_v2ray_transport() {
echo
while :; do
echo -e "请选择 "$yellow"V2Ray"$none" 传输协议 [${magenta}1-15$none]"
echo -e "请选择 "$yellow"V2Ray"$none" 传输协议 [${magenta}1-${#transport[*]}$none]"
echo
for ((i = 1; i <= ${#transport[*]}; i++)); do
Stream="${transport[$i - 1]}"
@ -1013,13 +1024,15 @@ change_v2ray_transport() {
fi
fi
if [[ $is_ws_path ]]; then
sed -i "41s/true/false/" $backup
# sed -i "41s/true/false/" $backup
backup_config -ws_path
fi
elif [[ $v2ray_transport -ge 9 ]]; then
del_port "multiport"
fi
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}"
config
clear
@ -1027,7 +1040,8 @@ change_v2ray_transport() {
view_v2ray_config_info
download_v2ray_config_ask
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
del_port "80"
del_port "443"
@ -1047,7 +1061,8 @@ change_v2ray_transport() {
fi
fi
if [[ $is_ws_path ]]; then
sed -i "41s/true/false/" $backup
# sed -i "41s/true/false/" $backup
backup_config -ws_path
fi
elif [[ $v2ray_transport -ge 9 ]]; then
del_port "multiport"
@ -1110,11 +1125,14 @@ ws_config() {
ws_path_config_ask
pause
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
sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
echo "$proxy_site" >>$backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path=$new_ws_path
proxy_site=$new_proxy_site
is_ws_path=true
fi
@ -1165,11 +1183,14 @@ ws_config() {
ws_path_config_ask
pause
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
sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
echo "$proxy_site" >>$backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path=$new_ws_path
proxy_site=$new_proxy_site
is_ws_path=true
fi
if [[ $v2ray_transport -ge 9 ]]; then
@ -1195,7 +1216,8 @@ ws_config() {
echo
pause
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
del_port "multiport"
fi
@ -1252,9 +1274,9 @@ ws_path_config() {
[[ -z $new_ws_path ]] && new_ws_path="233blog"
case $new_ws_path in
*/*)
*[/$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以不能包含 $red/$none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以分流的路径不能包含$red / $none$red $ $none个符号.... "
echo
error
;;
@ -1274,18 +1296,24 @@ proxy_site_config() {
echo
while :; do
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 "其实就是一个反代...明白就好..."
echo -e "如果不能伪装成功...可以使用 v2ray config 修改伪装的网址"
read -p "$(echo -e "(默认: [${cyan}https://liyafly.com$none]):")" proxy_site
[[ -z $proxy_site ]] && proxy_site="https://liyafly.com"
read -p "$(echo -e "(默认: [${cyan}https://liyafly.com$none]):")" new_proxy_site
[[ -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 -e "$yellow 伪装的网址 = ${cyan}${proxy_site}$none"
echo -e "$yellow 伪装的网址 = ${cyan}${new_proxy_site}$none"
echo "----------------------------------------------------------------"
echo
break
@ -1295,12 +1323,19 @@ proxy_site_config() {
}
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_file="/tmp/install_caddy/caddy.tar.gz"
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
local caddy_download_link="https://caddyserver.com/download/linux/amd64"
local caddy_download_link="https://caddyserver.com/download/linux/amd64?license=personal"
else
echo -e "$red 自动安装 Caddy 失败!不支持你的系统。$none" && exit 1
fi
@ -1318,18 +1353,26 @@ install_caddy() {
echo -e "$red 安装 Caddy 出错!" && exit 1
fi
setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/caddy
if [[ $systemd ]]; then
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
else
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
update-rc.d -f caddy defaults
fi
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/
rm -rf $caddy_tmp
@ -1337,11 +1380,12 @@ install_caddy() {
caddy_config() {
local email=$(shuf -i1-10000000000 -n1)
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
$domain {
tls ${email}@gmail.com
gzip
timeouts none
proxy / $proxy_site {
without /${ws_path}
}
@ -1355,6 +1399,7 @@ $domain {
cat >/etc/caddy/Caddyfile <<-EOF
$domain {
tls ${email}@gmail.com
timeouts none
proxy / 127.0.0.1:${v2ray_port} {
websocket
}
@ -1377,7 +1422,7 @@ v2ray_dynamic_port_start() {
echo " 不能和 V2Ray 端口一毛一样...."
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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
if [[ $shadowsocks ]] && [[ $v2ray_dynamic_port_start_input == $ssport ]]; then
echo
echo " 不能和 Shadowsocks 端口一毛一样...."
@ -1415,7 +1460,7 @@ v2ray_dynamic_port_end() {
read -p "$(echo -e "(默认结束端口: ${cyan}20000$none):")" v2ray_dynamic_port_end_input
[ -z $v2ray_dynamic_port_end_input ] && v2ray_dynamic_port_end_input=20000
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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
if [[ $v2ray_dynamic_port_end_input -le $v2ray_dynamic_port_start_input ]]; then
echo
@ -1457,12 +1502,13 @@ change_v2ray_dynamicport() {
pause
del_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}"
config
# clear
echo
echo -e "$green 动态端口修改成功啦...你不需要修改 V2Ray 客户端配置...保持原有的配置即可..."
echo -e "$green 动态端口修改成功啦...你不需要修改 V2Ray 客户端配置...保持原有的配置即可...$none"
echo
else
echo
@ -1506,7 +1552,7 @@ change_v2ray_dynamic_port_start() {
echo " 不能和 V2Ray 端口一毛一样...."
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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
if [[ $shadowsocks ]] && [[ $v2ray_dynamic_port_start_input == $ssport ]]; then
echo
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
[ -z $v2ray_dynamic_port_end_input ] && error && continue
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] | 65[0-4][0-9][0-9] | 655[0-3][0-5])
if [[ $v2ray_dynamic_port_end_input -le $v2ray_dynamic_port_start_input ]]; then
echo
@ -1597,7 +1643,8 @@ change_v2ray_id() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "21s/$v2ray_id/$uuid/;" $backup
# sed -i "21s/$v2ray_id/$uuid/;" $backup
backup_config uuid
v2ray_id=$uuid
config
clear
@ -1659,7 +1706,8 @@ change_domain() {
echo
pause
domain_check
sed -i "27s/$domain/$new_domain/" $backup
# sed -i "27s/$domain/$new_domain/" $backup
backup_config domain
domain=$new_domain
caddy_config
config
@ -1704,9 +1752,9 @@ change_ws_path_config() {
echo
error
;;
*/*)
*[/$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以不能包含 $red/$none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以分流的路径不能包含$red / $none$red $ $none个符号.... "
echo
error
;;
@ -1721,7 +1769,8 @@ change_ws_path_config() {
esac
done
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
caddy_config
config
@ -1731,9 +1780,11 @@ change_ws_path_config() {
elif [[ $v2ray_transport == 4 && $caddy_installed ]]; then
ws_path_config_ask
if [[ $new_ws_path ]]; then
sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
echo "$proxy_site" >>$backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path=$new_ws_path
proxy_site=$new_proxy_site
is_ws_path=true
caddy_config
config
@ -1774,14 +1825,20 @@ change_proxy_site_config() {
echo -e "然后打开你的域名时候...显示出来的内容就是来自 https://liyafly.com 的内容"
echo -e "其实就是一个反代...明白就好..."
echo -e "如果不能伪装成功...可以使用 v2ray config 修改伪装的网址"
read -p "$(echo -e "(当前伪装的网址: [${cyan}$(sed '$!d' $backup)$none]):")" proxy_site
[[ -z $proxy_site ]] && error && continue
read -p "$(echo -e "(当前伪装的网址: [${cyan}${proxy_site}$none]):")" new_proxy_site
[[ -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 -e "$yellow 伪装的网址 = ${cyan}${proxy_site}$none"
echo -e "$yellow 伪装的网址 = ${cyan}${new_proxy_site}$none"
echo "----------------------------------------------------------------"
echo
break
@ -1789,8 +1846,10 @@ change_proxy_site_config() {
esac
done
pause
sed -i "$ d" $backup
echo "$proxy_site" >>$backup
# sed -i "$ d" $backup
# echo "$proxy_site" >>$backup
backup_config proxy_site
proxy_site=$new_proxy_site
caddy_config
echo
echo
@ -1802,9 +1861,11 @@ change_proxy_site_config() {
elif [[ $v2ray_transport == 4 && $caddy_installed ]]; then
ws_path_config_ask
if [[ $new_ws_path ]]; then
sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
echo "$proxy_site" >>$backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path=$new_ws_path
proxy_site=$new_proxy_site
is_ws_path=true
caddy_config
config
@ -1838,7 +1899,7 @@ change_proxy_site_config() {
}
domain_check() {
# 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
echo
echo -e "$red 检测域名解析错误....$none"
@ -1867,7 +1928,8 @@ disable_ws_path() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "41s/true/false/" $backup
# sed -i "41s/true/false/" $backup
backup_config -ws_path
is_ws_path=''
caddy_config
config
@ -1944,7 +2006,8 @@ blocked_hosts() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "39s/false/true/" $backup
# sed -i "39s/false/true/" $backup
backup_config +ad
is_blocked_ad=true
config
echo
@ -1962,7 +2025,8 @@ blocked_hosts() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "39s/true/false/" $backup
# sed -i "39s/true/false/" $backup
backup_config -ad
is_blocked_ad=''
config
echo
@ -1984,6 +2048,41 @@ blocked_hosts() {
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() {
while :; do
echo
@ -2211,7 +2310,7 @@ create_v2ray_config_text() {
echo
echo "用户ID (User ID / UUID) = ${v2ray_id}"
echo
echo "额外ID (Alter Id) = 233"
echo "额外ID (Alter Id) = ${alterId}"
echo
echo "传输协议 (Network) = ${network}"
echo
@ -2238,7 +2337,7 @@ create_v2ray_config_text() {
echo
echo "用户ID (User ID / UUID) = ${v2ray_id}"
echo
echo "额外ID (Alter Id) = 233"
echo "额外ID (Alter Id) = ${alterId}"
echo
echo "传输协议 (Network) = ${network}"
echo
@ -2332,7 +2431,7 @@ get_v2ray_config_qr_link() {
if [[ $ios_qr && $link3 ]]; then
echo -e "$yellow 适用于 Pepi / ShadowRay = $cyan${link3}$none"
echo
echo " 请在 Pepi / ShadowRay 配置界面将 Alter Id 设置为 233 (如果你使用 Pepi / ShadowRay)"
echo " 请在 Pepi / ShadowRay 配置界面将 Alter Id 设置为 ${alterId} (如果你使用 Pepi / ShadowRay)"
if [[ $v2ray_transport == 4 ]]; then
echo
echo " 请在 Pepi / ShadowRay 配置界面打开 TLS (Enable TLS) (如果你使用 Pepi / ShadowRay)"
@ -2488,8 +2587,8 @@ open_port() {
iptables-save >/etc/iptables.rules.v4
ip6tables-save >/etc/iptables.rules.v6
else
service iptables save
service ip6tables save
service iptables save >/dev/null 2>&1
service ip6tables save >/dev/null 2>&1
fi
}
@ -2521,8 +2620,8 @@ del_port() {
iptables-save >/etc/iptables.rules.v4
ip6tables-save >/etc/iptables.rules.v6
else
service iptables save
service ip6tables save
service iptables save >/dev/null 2>&1
service ip6tables save >/dev/null 2>&1
fi
}
update() {
@ -2583,6 +2682,8 @@ update_v2ray() {
echo
echo -e " $green 更新成功啦...当前 V2Ray 版本: ${cyan}$v2ray_latest_ver$none"
echo
echo -e " $yellow 温馨提示: 为了避免出现莫名其妙的问题...所以客户端 V2Ray 版本最好也是: ${cyan}$v2ray_latest_ver$none"
echo
rm -rf /tmp/v2ray
else
echo
@ -2720,7 +2821,7 @@ uninstall_v2ray() {
echo
echo "如果你觉得这个脚本有哪些地方不够好的话...请告诉我"
echo
echo "反馈问题: https://github.com/233boy/v2ray/issus"
echo "反馈问题: https://github.com/233boy/v2ray/issues"
echo
elif [[ $is_uninstall_v2ray ]]; then
@ -2764,7 +2865,7 @@ uninstall_v2ray() {
echo
echo "如果你觉得这个脚本有哪些地方不够好的话...请告诉我"
echo
echo "反馈问题: https://github.com/233boy/v2ray/issus"
echo "反馈问题: https://github.com/233boy/v2ray/issues"
echo
fi
}
@ -3346,10 +3447,10 @@ config() {
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
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
sed -i "41s/233blog/$ws_path/" $v2ray_client_config
else
@ -3357,18 +3458,92 @@ config() {
fi
else
[[ -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
zip -q -r -j --password "233blog.com" /etc/v2ray/233blog_v2ray.zip $v2ray_client_config
if [[ $new_shadowsocks ]]; then
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
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
}
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_() {
echo
echo -e "$green ........... V2Ray 配置链接集合 by 233blog.com ..........$none"
@ -3607,7 +3782,11 @@ Q | ssqr)
;;
status)
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
;;
start)
@ -3617,8 +3796,16 @@ stop)
stop_v2ray
;;
restart)
[[ $v2ray_transport == "4" && $caddy_installed ]] && do_service restart caddy
restart_v2ray
;;
reload)
config
[[ $v2ray_transport == "4" && $caddy_installed ]] && caddy_config
clear
view_v2ray_config_info
download_v2ray_config_ask
;;
log)
view_v2ray_log
;;
@ -3638,6 +3825,11 @@ un | uninstall)
233 | 2333 | 233boy | 233blog | 233blog.com)
_boom_
;;
v | version)
echo
echo -e " 当前 V2Ray 版本: ${green}$v2ray_ver$none / 当前 V2Ray 管理脚本版本: ${cyan}$_version$none"
echo
;;
bbr)
other
;;

Loading…
Cancel
Save