mirror of https://github.com/mack-a/v2ray-agent
Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # install.shpull/534/merge
commit
b334fa73ff
257
install.sh
257
install.sh
|
@ -219,27 +219,27 @@ readInstallProtocolType() {
|
|||
currentInstallProtocolType=
|
||||
|
||||
while read -r row; do
|
||||
if echo ${row} | grep -q 02_trojan_TCP_inbounds; then
|
||||
if echo "${row}" | grep -q 02_trojan_TCP_inbounds; then
|
||||
currentInstallProtocolType=${currentInstallProtocolType}'trojan'
|
||||
frontingType=02_trojan_TCP_inbounds
|
||||
fi
|
||||
if echo ${row} | grep -q VLESS_TCP_inbounds; then
|
||||
if echo "${row}" | grep -q VLESS_TCP_inbounds; then
|
||||
currentInstallProtocolType=${currentInstallProtocolType}'0'
|
||||
frontingType=02_VLESS_TCP_inbounds
|
||||
fi
|
||||
if echo ${row} | grep -q VLESS_WS_inbounds; then
|
||||
if echo "${row}" | grep -q VLESS_WS_inbounds; then
|
||||
currentInstallProtocolType=${currentInstallProtocolType}'1'
|
||||
fi
|
||||
if echo ${row} | grep -q trojan_gRPC_inbounds; then
|
||||
if echo "${row}" | grep -q trojan_gRPC_inbounds; then
|
||||
currentInstallProtocolType=${currentInstallProtocolType}'2'
|
||||
fi
|
||||
if echo ${row} | grep -q VMess_WS_inbounds; then
|
||||
if echo "${row}" | grep -q VMess_WS_inbounds; then
|
||||
currentInstallProtocolType=${currentInstallProtocolType}'3'
|
||||
fi
|
||||
if echo ${row} | grep -q 04_trojan_TCP_inbounds; then
|
||||
if echo "${row}" | grep -q 04_trojan_TCP_inbounds; then
|
||||
currentInstallProtocolType=${currentInstallProtocolType}'4'
|
||||
fi
|
||||
if echo ${row} | grep -q VLESS_gRPC_inbounds; then
|
||||
if echo "${row}" | grep -q VLESS_gRPC_inbounds; then
|
||||
currentInstallProtocolType=${currentInstallProtocolType}'5'
|
||||
fi
|
||||
done < <(find ${configPath} -name "*inbounds.json" | awk -F "[.]" '{print $1}')
|
||||
|
@ -372,7 +372,7 @@ cleanUp() {
|
|||
fi
|
||||
}
|
||||
|
||||
initVar $1
|
||||
initVar "$1"
|
||||
checkSystem
|
||||
checkCPUVendor
|
||||
readInstallType
|
||||
|
@ -594,14 +594,14 @@ installWarp(){
|
|||
|
||||
elif [[ "${release}" == "centos" ]]; then
|
||||
${installType} yum-utils >/dev/null 2>&1
|
||||
sudo rpm -ivh http://pkg.cloudflareclient.com/cloudflare-release-el${centosVersion}.rpm >/dev/null 2>&1
|
||||
sudo rpm -ivh "http://pkg.cloudflareclient.com/cloudflare-release-el${centosVersion}.rpm" >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
echoContent green " ---> 安装WARP"
|
||||
${installType} cloudflare-warp >/dev/null 2>&1
|
||||
if [[ -z $(which warp-cli) ]]; then
|
||||
echoContent red " ---> 安装WARP失败"
|
||||
exit 0;
|
||||
exit 0
|
||||
fi
|
||||
systemctl enable warp-svc
|
||||
warp-cli --accept-tos register
|
||||
|
@ -686,7 +686,8 @@ server {
|
|||
return 403;
|
||||
}
|
||||
EOF
|
||||
if [[ -n $(echo "${selectCustomInstallType}" |grep 2) && -n $(echo "${selectCustomInstallType}" |grep 5) ]] || [[ -z "${selectCustomInstallType}" ]];then
|
||||
|
||||
if echo "${selectCustomInstallType}" | grep -q 2 && echo "${selectCustomInstallType}" | grep -q 5 || [[ -z "${selectCustomInstallType}" ]]; then
|
||||
|
||||
cat <<EOF >>/etc/nginx/conf.d/alone.conf
|
||||
server {
|
||||
|
@ -825,14 +826,14 @@ checkIP() {
|
|||
handleFirewall stop
|
||||
fi
|
||||
|
||||
exit 0;
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if echo "${localIP}" | awk -F "[,]" '{print $2}' | grep -q "." || echo "${localIP}" | awk -F "[,]" '{print $2}' | grep -q ":"; then
|
||||
echoContent red "\n ---> 检测到多个ip,请确认是否关闭cloudflare的云朵"
|
||||
echoContent yellow " ---> 关闭云朵后等待三分钟后重试"
|
||||
echoContent yellow " ---> 检测到的ip如下:[${localIP}]"
|
||||
exit 0;
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echoContent green " ---> 当前域名ip为:[${localIP}]"
|
||||
|
@ -847,8 +848,8 @@ installTLS() {
|
|||
echoContent green " ---> 检测到证书"
|
||||
checkTLStatus "${tlsDomain}"
|
||||
if [[ "${tlsStatus}" == "已过期" ]]; then
|
||||
rm -rf $HOME/.acme.sh/${tlsDomain}_ecc/*
|
||||
rm -rf /etc/v2ray-agent/tls/${tlsDomain}*
|
||||
rm -rf "$HOME/.acme.sh/${tlsDomain}_ecc/*"
|
||||
rm -rf "/etc/v2ray-agent/tls/${tlsDomain}*"
|
||||
installTLS "$1"
|
||||
else
|
||||
echoContent green " ---> 证书有效"
|
||||
|
@ -867,9 +868,9 @@ installTLS() {
|
|||
elif [[ -d "$HOME/.acme.sh" ]] && [[ ! -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.cer" || ! -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.key" ]]; then
|
||||
echoContent green " ---> 安装TLS证书"
|
||||
if echo "${localIP}" | grep -q ":"; then
|
||||
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server letsencrypt --listen-v6 | tee -a /etc/v2ray-agent/tls/acme.log
|
||||
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server letsencrypt --listen-v6 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
|
||||
else
|
||||
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server letsencrypt | tee -a /etc/v2ray-agent/tls/acme.log
|
||||
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server letsencrypt | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
|
||||
fi
|
||||
|
||||
if [[ -d "$HOME/.acme.sh/${tlsDomain}_ecc" && -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.key" && -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.cer" ]]; then
|
||||
|
@ -927,7 +928,7 @@ randomPathFunction() {
|
|||
read -r -p '路径:' customPath
|
||||
|
||||
if [[ -z "${customPath}" ]]; then
|
||||
customPath=$(head -n 50 /dev/urandom | sed 's/[^a-z]//g' | strings -n 4 | tr 'A-Z' 'a-z' | head -1)
|
||||
customPath=$(head -n 50 /dev/urandom | sed 's/[^a-z]//g' | strings -n 4 | tr '[:upper:]' '[:lower:]' | head -1)
|
||||
currentPath=${customPath:0:4}
|
||||
customPath=${currentPath}
|
||||
else
|
||||
|
@ -968,12 +969,13 @@ handleNginx() {
|
|||
if [[ -z $(pgrep -f "nginx") ]] && [[ "$1" == "start" ]]; then
|
||||
nginx
|
||||
sleep 0.5
|
||||
if ! ps -ef | grep -v grep | grep -q nginx; then
|
||||
|
||||
if [[ -z $(pgrep -f nginx) ]]; then
|
||||
echoContent red " ---> Nginx启动失败"
|
||||
echoContent red " ---> 请手动尝试安装nginx后,再次执行脚本"
|
||||
exit 0
|
||||
fi
|
||||
elif [[ "$1" == "stop" ]] && [[ -n $(pgrep -f "nginx") ]]; then
|
||||
elif [[ -n $(pgrep -f "nginx") ]] && [[ "$1" == "stop" ]]; then
|
||||
nginx -s stop >/dev/null 2>&1
|
||||
sleep 0.5
|
||||
if [[ -n $(pgrep -f "nginx") ]]; then
|
||||
|
@ -1631,7 +1633,6 @@ EOF
|
|||
EOF
|
||||
fi
|
||||
|
||||
|
||||
# dns
|
||||
cat <<EOF >/etc/v2ray-agent/v2ray/conf/11_dns.json
|
||||
{
|
||||
|
@ -1646,7 +1647,7 @@ EOF
|
|||
# 回落nginx
|
||||
local fallbacksList='{"dest":31300,"xver":0},{"alpn":"h2","dest":31302,"xver":0}'
|
||||
|
||||
if [[ -n $(echo "${selectCustomInstallType}" | grep 4) || "$1" == "all" ]]; then
|
||||
if echo "${selectCustomInstallType}" | grep -q 4 || [[ "$1" == "all" ]]; then
|
||||
fallbacksList='{"dest":31296,"xver":1},{"alpn":"h2","dest":31302,"xver":0}'
|
||||
cat <<EOF >/etc/v2ray-agent/v2ray/conf/04_trojan_TCP_inbounds.json
|
||||
{
|
||||
|
@ -1714,7 +1715,6 @@ EOF
|
|||
EOF
|
||||
fi
|
||||
|
||||
|
||||
# VMess_WS
|
||||
if echo "${selectCustomInstallType}" | grep -q 3 || [[ "$1" == "all" ]]; then
|
||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'vws","dest":31299,"xver":1}'
|
||||
|
@ -1925,7 +1925,7 @@ initXrayFrontingConfig(){
|
|||
reloadCore
|
||||
fi
|
||||
|
||||
exit 0;
|
||||
exit 0
|
||||
}
|
||||
|
||||
# 初始化Xray 配置文件
|
||||
|
@ -2015,7 +2015,6 @@ EOF
|
|||
EOF
|
||||
fi
|
||||
|
||||
|
||||
# dns
|
||||
cat <<EOF >/etc/v2ray-agent/xray/conf/11_dns.json
|
||||
{
|
||||
|
@ -2032,7 +2031,7 @@ EOF
|
|||
local fallbacksList='{"dest":31300,"xver":0},{"alpn":"h2","dest":31302,"xver":0}'
|
||||
|
||||
# trojan
|
||||
if [[ -n $(echo "${selectCustomInstallType}" | grep 4) || "$1" == "all" ]]; then
|
||||
if echo "${selectCustomInstallType}" | grep -q 4 || [[ "$1" == "all" ]]; then
|
||||
fallbacksList='{"dest":31296,"xver":1},{"alpn":"h2","dest":31302,"xver":0}'
|
||||
cat <<EOF >/etc/v2ray-agent/xray/conf/04_trojan_TCP_inbounds.json
|
||||
{
|
||||
|
@ -2100,7 +2099,6 @@ EOF
|
|||
EOF
|
||||
fi
|
||||
|
||||
|
||||
# trojan_grpc
|
||||
if echo "${selectCustomInstallType}" | grep -q 2 || [[ "$1" == "all" ]]; then
|
||||
if ! echo "${selectCustomInstallType}" | grep -q 5 && [[ -n ${selectCustomInstallType} ]]; then
|
||||
|
@ -2140,7 +2138,6 @@ EOF
|
|||
EOF
|
||||
fi
|
||||
|
||||
|
||||
# VMess_WS
|
||||
if echo "${selectCustomInstallType}" | grep -q 3 || [[ "$1" == "all" ]]; then
|
||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'vws","dest":31299,"xver":1}'
|
||||
|
@ -2341,9 +2338,10 @@ defaultBase64Code() {
|
|||
|
||||
local subAccount
|
||||
subAccount=${currentHost}_$(echo "${id}_currentHost" | md5sum | awk '{print $1}')
|
||||
|
||||
if [[ "${type}" == "vlesstcp" ]]; then
|
||||
|
||||
if [[ "${coreInstallType}" == "1" ]] && echo ${currentInstallProtocolType} | grep -q 0; then
|
||||
if [[ "${coreInstallType}" == "1" ]] && echo "${currentInstallProtocolType}" | grep -q 0; then
|
||||
echoContent yellow " ---> 通用格式(VLESS+TCP+TLS/xtls-rprx-direct)"
|
||||
echoContent green " vless://${id}@${host}:${port}?encryption=none&security=xtls&type=tcp&host=${host}&headerType=none&sni=${host}&flow=xtls-rprx-direct#${email}\n"
|
||||
|
||||
|
@ -2368,7 +2366,7 @@ EOF
|
|||
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/xtls-rprx-splice)"
|
||||
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40${host}%3A${port}%3Fencryption%3Dnone%26security%3Dxtls%26type%3Dtcp%26${host}%3D${host}%26headerType%3Dnone%26sni%3D${host}%26flow%3Dxtls-rprx-splice%23${email}\n"
|
||||
|
||||
elif [[ "${coreInstallType}" == "2" || "${coreInstallType}" == "3" ]]; then
|
||||
elif [[ "${coreInstallType}" == 2 || "${coreInstallType}" == "3" ]]; then
|
||||
echoContent yellow " ---> 通用格式(VLESS+TCP+TLS)"
|
||||
echoContent green " vless://${id}@${host}:${port}?security=tls&encryption=none&host=${host}&headerType=none&type=tcp#${email}\n"
|
||||
|
||||
|
@ -2407,15 +2405,15 @@ EOF
|
|||
echoContent yellow " ---> 二维码 Trojan(Trojan+TCP+TLS/xtls-rprx-splice)"
|
||||
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%3A%2F%2F${id}%40${host}%3A${port}%3Fencryption%3Dnone%26security%3Dxtls%26type%3Dtcp%26${host}%3D${host}%26headerType%3Dnone%26sni%3D${host}%26flow%3Dxtls-rprx-splice%23${email}\n"
|
||||
|
||||
elif
|
||||
[[ "${type}" == "vmessws" ]]
|
||||
then
|
||||
|
||||
elif [[ "${type}" == "vmessws" ]]; then
|
||||
|
||||
qrCodeBase64Default=$(echo -n '{"port":"'${port}'","ps":"'"${email}"'","tls":"tls","id":"'"${id}"'","aid":"0","v":"2","host":"'"${host}"'","type":"none","path":"/'"${path}"'","net":"ws","add":"'"${add}"'","allowInsecure":0,"method":"none","peer":"'"${host}"'","sni":"'${host}'"}' | sed 's#/#\\\/#g' | base64)
|
||||
qrCodeBase64Default=$(echo -n "{\"port\":${port},\"ps\":\"${email}\",\"tls\":\"tls\",\"id\":\"${id}\",\"aid\":0,\"v\":2,\"host\":\"${host}\",\"type\":\"none\",\"path\":\"/${path}\",\"net\":\"ws\",\"add\":\"${add}\",\"allowInsecure\":0,\"method\":\"none\",\"peer\":\"${host}\",\"sni\":\"${host}\"}" | sed 's#/#\\\/#g' | base64)
|
||||
qrCodeBase64Default="${qrCodeBase64Default// /}"
|
||||
|
||||
|
||||
echoContent yellow " ---> 通用json(VMess+WS+TLS)"
|
||||
echoContent green " {"port":"'${port}'","ps":'"${ps}"',"tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":'${host}',"type":"none","path":"/'${path}'","net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'","sni":"'${host}'"}\n"
|
||||
echoContent green " {\"port\":${port},\"ps\":\"${email}\",\"tls\":\"tls\",\"id\":\"${id}\",\"aid\":0,\"v\":2,\"host\":'${host}',\"type\":\"none\",\"path\":\"${path}\",\"net\":\"ws\",\"add\":\"${add}\",\"allowInsecure\":0,\"method\":\"none\",\"peer\":\"${host}\",\"sni\":\"${host}\"}\n"
|
||||
echoContent yellow " ---> 通用vmess(VMess+WS+TLS)链接"
|
||||
echoContent green " vmess://${qrCodeBase64Default}\n"
|
||||
echoContent yellow " ---> 二维码 vmess(VMess+WS+TLS)"
|
||||
|
@ -2427,25 +2425,12 @@ EOF
|
|||
|
||||
elif [[ "${type}" == "vmesstcp" ]]; then
|
||||
|
||||
# echoContent yellow " ---> 通用格式[新版,推荐]"
|
||||
#
|
||||
# echoContent green " vmess://tcp+tls:2e6257c5-1402-41a6-a96d-1e0bdad78159-0@vu3.s83h.xyz:443/?type=http&tlsServerName=vu3.s83h.xyz#vu3.s83h.xyz_vmess_tcp"
|
||||
# echoContent green " vmess://tcp+tls:${id//\"/}-0@${add}:${port}/?type=http&path=/${path}&tlsServerName=${host}&alpn=http1.1#${ps//\"/}\n"
|
||||
#
|
||||
# echoContent yellow " ---> 格式化明文(vmess+http+tls)"
|
||||
# echoContent green "协议类型:vmess,地址:${host},端口:${port},用户ID:${id},安全:tls,传输方式:http,账户名:${ps}\n"
|
||||
# cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
|
||||
#vmess://http+tls:${id}-0@${add}:${port}/?path=/${path}&tlsServerName=${host}&alpn=http1.1#${ps}
|
||||
#EOF
|
||||
# echoContent yellow " ---> 二维码 vmess(http+tls)"
|
||||
# echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vmess%3A%2F%2Fhttp%2Btls%3A${id}-0%40add%3A${port}%2F%3Fpath%3D%2F${path}%26tlsServerName%3D${host}%26alpn%3Dhttp1.1%23%24%7B${ps}%7D\n"
|
||||
|
||||
echoContent red path:${path}
|
||||
qrCodeBase64Default=$(echo -n '{"add":"'${add}'","aid":"0","host":"'${host}'","id":'"${id}"',"net":"tcp","path":"/'${path}'","port":"'${port}'","ps":'${ps}',"scy":"none","sni":"'${host}'","tls":"tls","v":"2","type":"http","allowInsecure":0,"peer":"'${host}'","obfs":"http","obfsParam":"'${host}'"}' | base64)
|
||||
qrCodeBase64Default=$(echo ${qrCodeBase64Default} | sed 's/ //g')
|
||||
echoContent red "path:${path}"
|
||||
qrCodeBase64Default=$(echo -n "{\"add\":\"${add}\",\"aid\":0,\"host\":\"${host}\",\"id\":\"${id}\",\"net\":\"tcp\",\"path\":\"${path}\",\"port\":${port},\"ps\":\"${email}\",\"scy\":\"none\",\"sni\":\"${host}\",\"tls\":\"tls\",\"v\":2,\"type\":\"http\",\"allowInsecure\":0,\"peer\":\"${host}\",\"obfs\":\"http\",\"obfsParam\":\"${host}\"}" | base64)
|
||||
qrCodeBase64Default="${qrCodeBase64Default// /}"
|
||||
|
||||
echoContent yellow " ---> 通用json(VMess+TCP+TLS)"
|
||||
echoContent green ' {"port":"'${port}'","ps":'${ps}',"tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"http","path":"/'${path}'","net":"http","add":"'${add}'","allowInsecure":0,"method":"post","peer":"'${host}'","obfs":"http","obfsParam":"'${host}'"}\n'
|
||||
echoContent green " {\"port\":'${port}',\"ps\":\"${email}\",\"tls\":\"tls\",\"id\":\"${id}\",\"aid\":0,\"v\":2,\"host\":\"${host}\",\"type\":\"http\",\"path\":\"${path}\",\"net\":\"http\",\"add\":\"${add}\",\"allowInsecure\":0,\"method\":\"post\",\"peer\":\"${host}\",\"obfs\":\"http\",\"obfsParam\":\"${host}\"}\n"
|
||||
echoContent yellow " ---> 通用vmess(VMess+TCP+TLS)链接"
|
||||
echoContent green " vmess://${qrCodeBase64Default}\n"
|
||||
|
||||
|
@ -2530,6 +2515,7 @@ EOF
|
|||
fi
|
||||
|
||||
}
|
||||
|
||||
# 账号
|
||||
showAccounts() {
|
||||
readInstallType
|
||||
|
@ -2545,7 +2531,7 @@ showAccounts() {
|
|||
jq .inbounds[0].settings.clients ${configPath}02_trojan_TCP_inbounds.json | jq -c '.[]' | while read -r user; do
|
||||
echoContent skyBlue "\n ---> 帐号:$(echo "${user}" | jq -r .email)_$(echo "${user}" | jq -r .password)"
|
||||
echo
|
||||
defaultBase64Code trojanTCPXTLS "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .password)" "${currentHost}:${currentPort}" ${currentHost}
|
||||
defaultBase64Code trojanTCPXTLS "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .password)" "${currentHost}:${currentPort}" "${currentHost}"
|
||||
done
|
||||
|
||||
else
|
||||
|
@ -2553,11 +2539,10 @@ showAccounts() {
|
|||
jq .inbounds[0].settings.clients ${configPath}02_VLESS_TCP_inbounds.json | jq -c '.[]' | while read -r user; do
|
||||
echoContent skyBlue "\n ---> 帐号:$(echo "${user}" | jq -r .email)_$(echo "${user}" | jq -r .id)"
|
||||
echo
|
||||
defaultBase64Code vlesstcp "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .id)" "${currentHost}:${currentPort}" ${currentHost}
|
||||
defaultBase64Code vlesstcp "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .id)" "${currentHost}:${currentPort}" "${currentHost}"
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# VLESS WS
|
||||
if echo ${currentInstallProtocolType} | grep -q 1; then
|
||||
echoContent skyBlue "\n================================ VLESS WS TLS CDN ================================\n"
|
||||
|
@ -2570,7 +2555,7 @@ showAccounts() {
|
|||
echoContent yellow "Xray的0-RTT path后面会有?ed=2048,不兼容以v2ray为核心的客户端,请手动删除?ed=2048后使用\n"
|
||||
path="${currentPath}ws?ed=2048"
|
||||
fi
|
||||
defaultBase64Code vlessws "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .id)" "${currentHost}:${currentPort}" ${path} ${currentAdd}
|
||||
defaultBase64Code vlessws "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .id)" "${currentHost}:${currentPort}" "${path}" "${currentAdd}"
|
||||
done
|
||||
fi
|
||||
|
||||
|
@ -2584,7 +2569,7 @@ showAccounts() {
|
|||
jq .inbounds[0].settings.clients ${configPath}05_VMess_WS_inbounds.json | jq -c '.[]' | while read -r user; do
|
||||
echoContent skyBlue "\n ---> 帐号:$(echo "${user}" | jq -r .email)_$(echo "${user}" | jq -r .id)"
|
||||
echo
|
||||
defaultBase64Code vmessws "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .id)" "${currentHost}:${currentPort}" ${path} ${currentAdd}
|
||||
defaultBase64Code vmessws "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .id)" "${currentHost}:${currentPort}" "${path}" "${currentAdd}"
|
||||
done
|
||||
fi
|
||||
|
||||
|
@ -2592,11 +2577,12 @@ showAccounts() {
|
|||
if echo ${currentInstallProtocolType} | grep -q 5; then
|
||||
echoContent skyBlue "\n=============================== VLESS gRPC TLS CDN ===============================\n"
|
||||
echoContent red "\n --->gRPC目前处于测试阶段,可能对你使用的客户端不兼容,如不能使用请忽略"
|
||||
local serviceName=$(jq -r .inbounds[0].streamSettings.grpcSettings.serviceName ${configPath}06_VLESS_gRPC_inbounds.json)
|
||||
local serviceName
|
||||
serviceName=$(jq -r .inbounds[0].streamSettings.grpcSettings.serviceName ${configPath}06_VLESS_gRPC_inbounds.json)
|
||||
jq .inbounds[0].settings.clients ${configPath}06_VLESS_gRPC_inbounds.json | jq -c '.[]' | while read -r user; do
|
||||
echoContent skyBlue "\n ---> 帐号:$(echo "${user}" | jq -r .email)_$(echo "${user}" | jq -r .id)"
|
||||
echo
|
||||
defaultBase64Code vlessgrpc "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .id)" "${currentHost}:${currentPort}" ${serviceName} ${currentAdd}
|
||||
defaultBase64Code vlessgrpc "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .id)" "${currentHost}:${currentPort}" "${serviceName}" "${currentAdd}"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
@ -2619,7 +2605,7 @@ showAccounts() {
|
|||
jq .inbounds[0].settings.clients ${configPath}04_trojan_gRPC_inbounds.json | jq -c '.[]' | while read -r user; do
|
||||
echoContent skyBlue "\n ---> 帐号:$(echo "${user}" | jq -r .email)_$(echo "${user}" | jq -r .password)"
|
||||
echo
|
||||
defaultBase64Code trojangrpc "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .password)" "${currentHost}:${currentPort}" ${serviceName} ${currentAdd}
|
||||
defaultBase64Code trojangrpc "$(echo "${user}" | jq -r .email)" "$(echo "${user}" | jq -r .password)" "${currentHost}:${currentPort}" "${serviceName}" "${currentAdd}"
|
||||
done
|
||||
fi
|
||||
|
||||
|
@ -2683,7 +2669,7 @@ addCorePort() {
|
|||
if [[ -n "${newPort}" ]]; then
|
||||
|
||||
while read -r port; do
|
||||
cat <<EOF >${configPath}02_dokodemodoor_inbounds_${port}.json
|
||||
cat <<EOF >"${configPath}02_dokodemodoor_inbounds_${port}.json"
|
||||
{
|
||||
"inbounds": [
|
||||
{
|
||||
|
@ -2708,10 +2694,10 @@ EOF
|
|||
fi
|
||||
elif [[ "${selectNewPortType}" == "2" ]]; then
|
||||
|
||||
ls ${configPath} | grep dokodemodoor | awk -F "[_]" '{print $4}' | awk -F "[.]" '{print ""NR""":"$1}'
|
||||
find ${configPath} -name "*dokodemodoor*" | awk -F "[c][o][n][f][/]" '{print ""NR""":"$2}'
|
||||
read -r -p "请输入要删除的端口编号:" portIndex
|
||||
|
||||
local dokoConfig=$(ls ${configPath} | grep dokodemodoor | awk '{print ""NR""":"$1}' | grep ${portIndex}":")
|
||||
local dokoConfig
|
||||
dokoConfig=$(find ${configPath} -name "*dokodemodoor*" | awk -F "[c][o][n][f][/]" '{print ""NR""":"$2}' | grep "${portIndex}:")
|
||||
if [[ -n "${dokoConfig}" ]]; then
|
||||
rm "${configPath}/$(echo "${dokoConfig}" | awk -F "[:]" '{print $2}')"
|
||||
reloadCore
|
||||
|
@ -2767,7 +2753,7 @@ updateV2RayCDN() {
|
|||
# todo 重构此方法
|
||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 修改CDN节点"
|
||||
|
||||
if [[ -n ${currentAdd} ]]; then
|
||||
if [[ -n "${currentAdd}" ]]; then
|
||||
echoContent red "=============================================================="
|
||||
echoContent yellow "1.CNAME www.digitalocean.com"
|
||||
echoContent yellow "2.CNAME www.cloudflare.com"
|
||||
|
@ -2791,10 +2777,10 @@ updateV2RayCDN() {
|
|||
esac
|
||||
|
||||
if [[ -n ${setDomain} ]]; then
|
||||
if [[ -n ${currentAdd} ]]; then
|
||||
if [[ -n "${currentAdd}" ]]; then
|
||||
sed -i "s/\"${currentAdd}\"/\"${setDomain}\"/g" "$(grep "${currentAdd}" -rl ${configPath}${frontingType}.json)"
|
||||
fi
|
||||
if [[ $(jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType}.json) == ${setDomain} ]]; then
|
||||
if [[ $(jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType}.json) == "${setDomain}" ]]; then
|
||||
echoContent green " ---> CDN修改成功"
|
||||
reloadCore
|
||||
else
|
||||
|
@ -2833,10 +2819,9 @@ customUUID() {
|
|||
if [[ -z "${currentCustomUUID}" ]]; then
|
||||
echoContent red " ---> UUID不可为空"
|
||||
else
|
||||
local repeat=
|
||||
jq -r -c '.inbounds[0].settings.clients[].id' ${configPath}${frontingType}.json | while read -r line; do
|
||||
if [[ "${line}" == "${currentCustomUUID}" ]]; then
|
||||
echo repeat >/tmp/v2ray-agent
|
||||
echo >/tmp/v2ray-agent
|
||||
fi
|
||||
done
|
||||
if [[ -f "/tmp/v2ray-agent" && -n $(cat /tmp/v2ray-agent) ]]; then
|
||||
|
@ -2858,10 +2843,9 @@ customUserEmail() {
|
|||
if [[ -z "${currentCustomEmail}" ]]; then
|
||||
echoContent red " ---> email不可为空"
|
||||
else
|
||||
local repeat=
|
||||
jq -r -c '.inbounds[0].settings.clients[].email' ${configPath}${frontingType}.json | while read -r line; do
|
||||
if [[ "${line}" == "${currentCustomEmail}" ]]; then
|
||||
echo repeat >/tmp/v2ray-agent
|
||||
echo >/tmp/v2ray-agent
|
||||
fi
|
||||
done
|
||||
if [[ -f "/tmp/v2ray-agent" && -n $(cat /tmp/v2ray-agent) ]]; then
|
||||
|
@ -2885,72 +2869,55 @@ addUser() {
|
|||
fi
|
||||
|
||||
# 生成用户
|
||||
local users=
|
||||
local trojanGoUsers=
|
||||
if [[ "${userNum}" == "1" ]]; then
|
||||
customUUID
|
||||
customUserEmail
|
||||
fi
|
||||
|
||||
while [[ ${userNum} -gt 0 ]]; do
|
||||
|
||||
local users=
|
||||
((userNum--)) || true
|
||||
if [[ -n "${currentCustomUUID}" ]]; then
|
||||
uuid=${currentCustomUUID}
|
||||
else
|
||||
uuid=$(${ctlPath} uuid)
|
||||
fi
|
||||
|
||||
if [[ -n "${currentCustomEmail}" ]]; then
|
||||
email=${currentCustomEmail}
|
||||
else
|
||||
email=${currentHost}_${uuid}
|
||||
fi
|
||||
|
||||
if [[ ${userNum} == 0 ]]; then
|
||||
|
||||
users=${users}{\"id\":\"${uuid}\",\"flow\":\"xtls-rprx-direct\",\"email\":\"${email}\",\"alterId\":0}
|
||||
|
||||
if echo ${currentInstallProtocolType} | grep -q 4; then
|
||||
trojanGoUsers=${trojanGoUsers}\"${uuid}\"
|
||||
fi
|
||||
else
|
||||
users=${users}{\"id\":\"${uuid}\",\"flow\":\"xtls-rprx-direct\",\"email\":\"${email}\",\"alterId\":0},
|
||||
|
||||
if echo ${currentInstallProtocolType} | grep -q 4; then
|
||||
trojanGoUsers=${trojanGoUsers}\"${uuid}\",
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# 兼容v2ray-core
|
||||
users="{\"id\":\"${uuid}\",\"flow\":\"xtls-rprx-direct\",\"email\":\"${email}\",\"alterId\":0}"
|
||||
|
||||
if [[ "${coreInstallType}" == "2" ]]; then
|
||||
users="${users//\"flow\":\"xtls-rprx-direct\"\,/}"
|
||||
users="{\"id\":\"${uuid}\",\"email\":\"${email}\",\"alterId\":0}"
|
||||
fi
|
||||
|
||||
if echo ${currentInstallProtocolType} | grep -q 0; then
|
||||
local vlessUsers="${users//\,\"alterId\":0/}"
|
||||
|
||||
local vlessTcpResult
|
||||
vlessTcpResult=$(jq -r '.inbounds[0].settings.clients += ['${vlessUsers}']' ${configPath}${frontingType}.json)
|
||||
vlessTcpResult=$(jq -r ".inbounds[0].settings.clients += [${vlessUsers}]" ${configPath}${frontingType}.json)
|
||||
echo "${vlessTcpResult}" | jq . >${configPath}${frontingType}.json
|
||||
fi
|
||||
|
||||
if echo ${currentInstallProtocolType} | grep -q trojan; then
|
||||
local trojanXTLSUsers="${users//\,\"alterId\":0/}"
|
||||
trojanXTLSUsers=${trojanXTLSUsers//"id"/"password"}
|
||||
echo trojanXTLSUsers:${trojanXTLSUsers}
|
||||
|
||||
local trojanXTLSResult
|
||||
trojanXTLSResult=$(jq -r '.inbounds[0].settings.clients += ['${trojanXTLSUsers}']' ${configPath}${frontingType}.json)
|
||||
trojanXTLSResult=$(jq -r ".inbounds[0].settings.clients += [${trojanXTLSUsers}]" ${configPath}${frontingType}.json)
|
||||
echo "${trojanXTLSResult}" | jq . >${configPath}${frontingType}.json
|
||||
fi
|
||||
|
||||
# users="${users//"flow":"xtls-rprx-direct",/"alterId":1,}"
|
||||
|
||||
if echo ${currentInstallProtocolType} | grep -q 1; then
|
||||
local vlessUsers="${users//\,\"alterId\":0/}"
|
||||
vlessUsers="${vlessUsers//\"flow\":\"xtls-rprx-direct\"\,/}"
|
||||
local vlessWsResult
|
||||
vlessWsResult=$(jq -r '.inbounds[0].settings.clients += ['${vlessUsers}']' ${configPath}03_VLESS_WS_inbounds.json)
|
||||
vlessWsResult=$(jq -r ".inbounds[0].settings.clients += [${vlessUsers}]" ${configPath}03_VLESS_WS_inbounds.json)
|
||||
echo "${vlessWsResult}" | jq . >${configPath}03_VLESS_WS_inbounds.json
|
||||
fi
|
||||
|
||||
|
@ -2960,7 +2927,7 @@ addUser() {
|
|||
trojangRPCUsers=${trojangRPCUsers//"id"/"password"}
|
||||
|
||||
local trojangRPCResult
|
||||
trojangRPCResult=$(jq -r '.inbounds[0].settings.clients += ['${trojangRPCUsers}']' ${configPath}04_trojan_gRPC_inbounds.json)
|
||||
trojangRPCResult=$(jq -r ".inbounds[0].settings.clients += [${trojangRPCUsers}]" ${configPath}04_trojan_gRPC_inbounds.json)
|
||||
echo "${trojangRPCResult}" | jq . >${configPath}04_trojan_gRPC_inbounds.json
|
||||
fi
|
||||
|
||||
|
@ -2968,7 +2935,7 @@ addUser() {
|
|||
local vmessUsers="${users//\"flow\":\"xtls-rprx-direct\"\,/}"
|
||||
|
||||
local vmessWsResult
|
||||
vmessWsResult=$(jq -r '.inbounds[0].settings.clients += ['${vmessUsers}']' ${configPath}05_VMess_WS_inbounds.json)
|
||||
vmessWsResult=$(jq -r ".inbounds[0].settings.clients += [${vmessUsers}]" ${configPath}05_VMess_WS_inbounds.json)
|
||||
echo "${vmessWsResult}" | jq . >${configPath}05_VMess_WS_inbounds.json
|
||||
fi
|
||||
|
||||
|
@ -2977,7 +2944,7 @@ addUser() {
|
|||
vlessGRPCUsers="${vlessGRPCUsers//\,\"alterId\":0/}"
|
||||
|
||||
local vlessGRPCResult
|
||||
vlessGRPCResult=$(jq -r '.inbounds[0].settings.clients += ['${vlessGRPCUsers}']' ${configPath}06_VLESS_gRPC_inbounds.json)
|
||||
vlessGRPCResult=$(jq -r ".inbounds[0].settings.clients += [${vlessGRPCUsers}]" ${configPath}06_VLESS_gRPC_inbounds.json)
|
||||
echo "${vlessGRPCResult}" | jq . >${configPath}06_VLESS_gRPC_inbounds.json
|
||||
fi
|
||||
|
||||
|
@ -2986,19 +2953,11 @@ addUser() {
|
|||
trojanUsers="${trojanUsers//id/password}"
|
||||
trojanUsers="${trojanUsers//\,\"alterId\":0/}"
|
||||
|
||||
|
||||
local trojanTCPResult
|
||||
trojanTCPResult=$(jq -r '.inbounds[0].settings.clients += ['${trojanUsers}']' ${configPath}04_trojan_TCP_inbounds.json)
|
||||
trojanTCPResult=$(jq -r ".inbounds[0].settings.clients += [${trojanUsers}]" ${configPath}04_trojan_TCP_inbounds.json)
|
||||
echo "${trojanTCPResult}" | jq . >${configPath}04_trojan_TCP_inbounds.json
|
||||
fi
|
||||
|
||||
# if echo ${currentInstallProtocolType} | grep -q 4; then
|
||||
# local trojanResult
|
||||
# trojanResult=$(jq -r '.password += ['${trojanGoUsers}']' ${configPath}../../trojan/config_full.json)
|
||||
# echo "${trojanResult}" | jq . >${configPath}../../trojan/config_full.json
|
||||
# handleTrojanGo stop
|
||||
# handleTrojanGo start
|
||||
# fi
|
||||
done
|
||||
|
||||
reloadCore
|
||||
echoContent green " ---> 添加完成"
|
||||
|
@ -3014,7 +2973,7 @@ removeUser() {
|
|||
if [[ $(jq -r '.inbounds[0].settings.clients|length' ${configPath}${frontingType}.json) -lt ${delUserIndex} ]]; then
|
||||
echoContent red " ---> 选择错误"
|
||||
else
|
||||
delUserIndex=$((${delUserIndex} - 1))
|
||||
delUserIndex=$((delUserIndex - 1))
|
||||
local vlessTcpResult
|
||||
vlessTcpResult=$(jq -r 'del(.inbounds[0].settings.clients['${delUserIndex}'])' ${configPath}${frontingType}.json)
|
||||
echo "${vlessTcpResult}" | jq . >${configPath}${frontingType}.json
|
||||
|
@ -3053,6 +3012,7 @@ removeUser() {
|
|||
|
||||
reloadCore
|
||||
fi
|
||||
manageAccount 1
|
||||
}
|
||||
# 更新脚本
|
||||
updateV2RayAgent() {
|
||||
|
@ -3065,13 +3025,14 @@ updateV2RayAgent() {
|
|||
fi
|
||||
|
||||
sudo chmod 700 /etc/v2ray-agent/install.sh
|
||||
local version=$(cat /etc/v2ray-agent/install.sh | grep '当前版本:v' | awk -F "[v]" '{print $2}' | tail -n +2 | head -n 1 | awk -F "[\"]" '{print $1}')
|
||||
local version
|
||||
version=$(grep '当前版本:v' "/etc/v2ray-agent/install.sh" | awk -F "[v]" '{print $2}' | tail -n +2 | head -n 1 | awk -F "[\"]" '{print $1}')
|
||||
|
||||
echoContent green "\n ---> 更新完毕"
|
||||
echoContent yellow " ---> 请手动执行[vasma]打开脚本"
|
||||
echoContent green " ---> 当前版本:${version}\n"
|
||||
echoContent yellow "如更新不成功,请手动执行下面命令\n"
|
||||
echoContent skyBlue "wget -P /root -N --no-check-certificate "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/install.sh" && chmod 700 /root/install.sh && /root/install.sh"
|
||||
echoContent skyBlue "wget -P /root -N --no-check-certificate https://raw.githubusercontent.com/mack-a/v2ray-agent/master/install.sh && chmod 700 /root/install.sh && /root/install.sh"
|
||||
echo
|
||||
exit 0
|
||||
}
|
||||
|
@ -3113,7 +3074,7 @@ checkLog() {
|
|||
echoContent red " ---> 没有检测到安装目录,请执行脚本安装内容"
|
||||
fi
|
||||
local logStatus=false
|
||||
if [[ -n $(cat ${configPath}00_log.json | grep access) ]]; then
|
||||
if grep -q "access" ${configPath}00_log.json; then
|
||||
logStatus=true
|
||||
fi
|
||||
|
||||
|
@ -3184,7 +3145,7 @@ EOF
|
|||
# 脚本快捷方式
|
||||
aliasInstall() {
|
||||
|
||||
if [[ -f "$HOME/install.sh" ]] && [[ -d "/etc/v2ray-agent" ]] && grep <$HOME/install.sh -q "作者:mack-a"; then
|
||||
if [[ -f "$HOME/install.sh" ]] && [[ -d "/etc/v2ray-agent" ]] && grep <"$HOME/install.sh" -q "作者:mack-a"; then
|
||||
mv "$HOME/install.sh" /etc/v2ray-agent/install.sh
|
||||
local vasmaType=
|
||||
if [[ -d "/usr/bin/" ]]; then
|
||||
|
@ -3242,18 +3203,18 @@ ipv6Routing() {
|
|||
echoContent yellow "4.不允许有特殊字符,注意逗号的格式"
|
||||
echoContent yellow "5.每次添加都是重新添加,不会保留上次域名"
|
||||
echoContent yellow "6.录入示例:google,youtube,facebook\n"
|
||||
read -r -p "请按照上面示例录入域名:" domainList
|
||||
read -r -p "请按照上面示例录入域名:" domainList
|
||||
|
||||
if [[ -f "${configPath}09_routing.json" ]]; then
|
||||
|
||||
unInstallRouting IPv6-out
|
||||
|
||||
routing=$(jq -r '.routing.rules += [{"type":"field","domain":["geosite:'${domainList//,/\",\"geosite:}'"],"outboundTag":"IPv6-out"}]' ${configPath}09_routing.json)
|
||||
routing=$(jq -r ".routing.rules += [{\"type\":\"field\",\"domain\":[\"geosite:${domainList//,/\",\"geosite:}\"],\"outboundTag\":\"IPv6-out\"}]" ${configPath}09_routing.json)
|
||||
|
||||
echo "${routing}" | jq . >${configPath}09_routing.json
|
||||
|
||||
else
|
||||
cat <<EOF >${configPath}09_routing.json
|
||||
cat <<EOF >"${configPath}09_routing.json"
|
||||
{
|
||||
"routing":{
|
||||
"domainStrategy": "IPOnDemand",
|
||||
|
@ -3350,8 +3311,6 @@ fi
|
|||
|
||||
echo "${outbounds}" | jq . >${configPath}10_ipv4_outbounds.json
|
||||
|
||||
|
||||
|
||||
echoContent green " ---> BT下载禁用成功"
|
||||
|
||||
elif [[ "${btStatus}" == "2" ]]; then
|
||||
|
@ -3396,7 +3355,6 @@ unInstallOutbounds(){
|
|||
local ipv6OutIndex
|
||||
ipv6OutIndex=$(jq .outbounds[].tag ${configPath}10_ipv4_outbounds.json | awk '{print ""NR""":"$0}' | grep "${tag}" | awk -F "[:]" '{print $1}' | head -1)
|
||||
if [[ ${ipv6OutIndex} -gt 0 ]]; then
|
||||
routing
|
||||
routing=$(jq -r 'del(.outbounds['$(("${ipv6OutIndex}" - 1))'])' ${configPath}10_ipv4_outbounds.json)
|
||||
echo "${routing}" | jq . >${configPath}10_ipv4_outbounds.json
|
||||
fi
|
||||
|
@ -3406,17 +3364,19 @@ unInstallOutbounds(){
|
|||
|
||||
# 卸载嗅探
|
||||
unInstallSniffing() {
|
||||
ls ${configPath}|grep inbounds.json|while read -r inbound;do
|
||||
sniffing=$(jq -r 'del(.inbounds[0].sniffing)' ${configPath}${inbound})
|
||||
echo "${sniffing}" |jq . >${configPath}${inbound}
|
||||
|
||||
find ${configPath} -name "*inbounds.json*" | awk -F "[c][o][n][f][/]" '{print $2}' | while read -r inbound; do
|
||||
sniffing=$(jq -r 'del(.inbounds[0].sniffing)' "${configPath}${inbound}")
|
||||
echo "${sniffing}" | jq . >"${configPath}${inbound}"
|
||||
done
|
||||
}
|
||||
|
||||
# 安装嗅探
|
||||
installSniffing() {
|
||||
ls ${configPath}|grep inbounds.json|while read -r inbound;do
|
||||
sniffing=$(jq -r '.inbounds[0].sniffing = {"enabled":true,"destOverride":["http","tls"]}' ${configPath}${inbound})
|
||||
echo "${sniffing}" |jq . >${configPath}${inbound}
|
||||
|
||||
find ${configPath} -name "*inbounds.json*" | awk -F "[c][o][n][f][/]" '{print $2}' | while read -r inbound; do
|
||||
sniffing=$(jq -r '.inbounds[0].sniffing = {"enabled":true,"destOverride":["http","tls"]}' "${configPath}${inbound}")
|
||||
echo "${sniffing}" | jq . >"${configPath}${inbound}"
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -3456,12 +3416,12 @@ warpRouting(){
|
|||
echoContent yellow "5.不允许有特殊字符,注意逗号的格式"
|
||||
echoContent yellow "6.每次添加都是重新添加,不会保留上次域名"
|
||||
echoContent yellow "7.录入示例:google,youtube,facebook\n"
|
||||
read -r -p "请按照上面示例录入域名:" domainList
|
||||
read -r -p "请按照上面示例录入域名:" domainList
|
||||
|
||||
if [[ -f "${configPath}09_routing.json" ]]; then
|
||||
unInstallRouting warp-socks-out
|
||||
|
||||
routing=$(jq -r '.routing.rules += [{"type":"field","domain":["geosite:'${domainList//,/\",\"geosite:}'"],"outboundTag":"warp-socks-out"}]' ${configPath}09_routing.json)
|
||||
routing=$(jq -r ".routing.rules += [{\"type\":\"field\",\"domain\":[\"geosite:${domainList//,/\",\"geosite:}\"],\"outboundTag\":\"warp-socks-out\"}]" ${configPath}09_routing.json)
|
||||
|
||||
echo "${routing}" | jq . >${configPath}09_routing.json
|
||||
|
||||
|
@ -3485,7 +3445,8 @@ EOF
|
|||
fi
|
||||
unInstallOutbounds warp-socks-out
|
||||
|
||||
local outbounds=$(jq -r '.outbounds += [{"protocol":"socks","settings":{"servers":[{"address":"127.0.0.1","port":31303}]},"tag":"warp-socks-out"}]' ${configPath}10_ipv4_outbounds.json)
|
||||
local outbounds
|
||||
outbounds=$(jq -r '.outbounds += [{"protocol":"socks","settings":{"servers":[{"address":"127.0.0.1","port":31303}]},"tag":"warp-socks-out"}]' ${configPath}10_ipv4_outbounds.json)
|
||||
|
||||
echo "${outbounds}" | jq . >${configPath}10_ipv4_outbounds.json
|
||||
|
||||
|
@ -3562,7 +3523,7 @@ setDokodemoDoorUnblockNetflixOutbounds() {
|
|||
unInstallOutbounds netflix-80
|
||||
unInstallOutbounds netflix-443
|
||||
|
||||
outbounds=$(jq -r '.outbounds += [{"tag":"netflix-80","protocol":"freedom","settings":{"domainStrategy":"AsIs","redirect":"'${setIP}':22387"}},{"tag":"netflix-443","protocol":"freedom","settings":{"domainStrategy":"AsIs","redirect":"'${setIP}':22388"}}]' ${configPath}10_ipv4_outbounds.json)
|
||||
outbounds=$(jq -r ".outbounds += [{\"tag\":\"netflix-80\",\"protocol\":\"freedom\",\"settings\":{\"domainStrategy\":\"AsIs\",\"redirect\":\"${setIP}:22387\"}},{\"tag\":\"netflix-443\",\"protocol\":\"freedom\",\"settings\":{\"domainStrategy\":\"AsIs\",\"redirect\":\"${setIP}:22388\"}}]" ${configPath}10_ipv4_outbounds.json)
|
||||
|
||||
echo "${outbounds}" | jq . >${configPath}10_ipv4_outbounds.json
|
||||
|
||||
|
@ -3570,7 +3531,8 @@ setDokodemoDoorUnblockNetflixOutbounds() {
|
|||
unInstallRouting netflix-80
|
||||
unInstallRouting netflix-443
|
||||
|
||||
local routing=$(jq -r '.routing.rules += [{"type":"field","port":80,"domain":["ip.sb","geosite:netflix"],"outboundTag":"netflix-80"},{"type":"field","port":443,"domain":["ip.sb","geosite:netflix"],"outboundTag":"netflix-443"}]' ${configPath}09_routing.json)
|
||||
local routing
|
||||
routing=$(jq -r '.routing.rules += [{"type":"field","port":80,"domain":["ip.sb","geosite:netflix"],"outboundTag":"netflix-80"},{"type":"field","port":443,"domain":["ip.sb","geosite:netflix"],"outboundTag":"netflix-443"}]' ${configPath}09_routing.json)
|
||||
echo "${routing}" | jq . >${configPath}09_routing.json
|
||||
else
|
||||
cat <<EOF >${configPath}09_routing.json
|
||||
|
@ -3716,17 +3678,20 @@ EOF
|
|||
}
|
||||
}
|
||||
EOF
|
||||
local ips=
|
||||
while read -r ip; do
|
||||
if [[ -z ${ips} ]];then
|
||||
ips=\"${ip}\"
|
||||
else
|
||||
ips=${ips},\"${ip}\"
|
||||
fi
|
||||
done< <(echo ${setIPs}|tr ',' '\n')
|
||||
|
||||
local routing=$(jq -r '.routing.rules[0].source += ['${ips}']' ${configPath}09_routing.json)
|
||||
oldIFS="${IFS}"
|
||||
IFS=","
|
||||
# shellcheck disable=SC2206
|
||||
sourceIPs=(${setIPs})
|
||||
IFS="${oldIFS}"
|
||||
|
||||
local routing
|
||||
|
||||
for value in "${sourceIPs[@]}"; do
|
||||
routing=$(jq -r ".routing.rules[0].source += [\"${value}\"]" ${configPath}09_routing.json)
|
||||
echo "${routing}" | jq . >${configPath}09_routing.json
|
||||
done
|
||||
|
||||
reloadCore
|
||||
echoContent green " ---> 添加落地机入站解锁Netflix成功"
|
||||
exit 0
|
||||
|
@ -4135,9 +4100,11 @@ subscribe() {
|
|||
mv /etc/v2ray-agent/subscribe_tmp/* /etc/v2ray-agent/subscribe/
|
||||
|
||||
if [[ -n $(ls /etc/v2ray-agent/subscribe) ]]; then
|
||||
ls /etc/v2ray-agent/subscribe | while read -r email; do
|
||||
local base64Result=$(base64 -w 0 /etc/v2ray-agent/subscribe/${email})
|
||||
echo ${base64Result} >"/etc/v2ray-agent/subscribe/${email}"
|
||||
find /etc/v2ray-agent/subscribe | while read -r email; do
|
||||
email=$(echo "${email}" | awk -F "[s][u][b][s][c][r][i][b][e][/]" '{print $2}')
|
||||
local base64Result
|
||||
base64Result=$(base64 -w 0 "/etc/v2ray-agent/subscribe/${email}")
|
||||
echo "${base64Result}" >"/etc/v2ray-agent/subscribe/${email}"
|
||||
echoContent skyBlue "--------------------------------------------------------------"
|
||||
echoContent yellow "email:$(echo "${email}" | awk -F "[_]" '{print $1}')\n"
|
||||
echoContent yellow "url:https://${currentHost}/s/${email}\n"
|
||||
|
@ -4156,7 +4123,7 @@ menu() {
|
|||
cd "$HOME" || exit
|
||||
echoContent red "\n=============================================================="
|
||||
echoContent green "作者:mack-a"
|
||||
echoContent green "当前版本:v2.5.28"
|
||||
echoContent green "当前版本:v2.5.29"
|
||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||
echoContent green "描述:八合一共存脚本\c"
|
||||
showInstallStatus
|
||||
|
|
Loading…
Reference in New Issue