feat(脚本): 添加ClashMeta订阅

pull/656/head
mack-a 2023-04-17 17:35:53 +08:00
parent 84c4a233cd
commit db28c839e0
1 changed files with 377 additions and 30 deletions

View File

@ -675,8 +675,11 @@ readXrayCoreRealityConfig
# 初始化安装目录 # 初始化安装目录
mkdirTools() { mkdirTools() {
mkdir -p /etc/v2ray-agent/tls mkdir -p /etc/v2ray-agent/tls
mkdir -p /etc/v2ray-agent/subscribe mkdir -p /etc/v2ray-agent/subscribe/default
mkdir -p /etc/v2ray-agent/subscribe_tmp mkdir -p /etc/v2ray-agent/subscribe/clashMeta
mkdir -p /etc/v2ray-agent/subscribe/clashMetaProfiles
mkdir -p /etc/v2ray-agent/subscribe_tmp/default
mkdir -p /etc/v2ray-agent/subscribe_tmp/clashMeta
mkdir -p /etc/v2ray-agent/v2ray/conf mkdir -p /etc/v2ray-agent/v2ray/conf
mkdir -p /etc/v2ray-agent/v2ray/tmp mkdir -p /etc/v2ray-agent/v2ray/tmp
mkdir -p /etc/v2ray-agent/xray/conf mkdir -p /etc/v2ray-agent/xray/conf
@ -1059,7 +1062,7 @@ server {
keepalive_timeout 1071906480m; keepalive_timeout 1071906480m;
location /s/ { location /s/ {
add_header Content-Type text/plain; default_type 'text/plain; charset=utf-8';
alias /etc/v2ray-agent/subscribe/; alias /etc/v2ray-agent/subscribe/;
} }
@ -1096,7 +1099,7 @@ server {
server_name ${domain}; server_name ${domain};
root ${nginxStaticPath}; root ${nginxStaticPath};
location /s/ { location /s/ {
add_header Content-Type text/plain; default_type 'text/plain; charset=utf-8';
alias /etc/v2ray-agent/subscribe/; alias /etc/v2ray-agent/subscribe/;
} }
location /${currentPath}grpc { location /${currentPath}grpc {
@ -1121,7 +1124,7 @@ server {
server_name ${domain}; server_name ${domain};
root ${nginxStaticPath}; root ${nginxStaticPath};
location /s/ { location /s/ {
add_header Content-Type text/plain; default_type 'text/plain; charset=utf-8';
alias /etc/v2ray-agent/subscribe/; alias /etc/v2ray-agent/subscribe/;
} }
location /${currentPath}trojangrpc { location /${currentPath}trojangrpc {
@ -1145,7 +1148,7 @@ server {
server_name ${domain}; server_name ${domain};
root ${nginxStaticPath}; root ${nginxStaticPath};
location /s/ { location /s/ {
add_header Content-Type text/plain; default_type 'text/plain; charset=utf-8';
alias /etc/v2ray-agent/subscribe/; alias /etc/v2ray-agent/subscribe/;
} }
location / { location / {
@ -1160,7 +1163,7 @@ server {
server_name ${domain}; server_name ${domain};
root ${nginxStaticPath}; root ${nginxStaticPath};
location /s/ { location /s/ {
add_header Content-Type text/plain; default_type 'text/plain; charset=utf-8';
alias /etc/v2ray-agent/subscribe/; alias /etc/v2ray-agent/subscribe/;
} }
location / { location / {
@ -3426,8 +3429,20 @@ defaultBase64Code() {
echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS_Vision)" echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS_Vision)"
echoContent green "协议类型:VLESS地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:tcpflow:xtls-rprx-vision账户名:${email}\n" echoContent green "协议类型:VLESS地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:tcpflow:xtls-rprx-vision账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
vless://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=tls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-vision#${email} vless://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=tls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-vision#${email}
EOF
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/clashMeta/${id}"
- name: "${email}"
type: vless
server: ${currentHost}
port: ${currentDefaultPort}
uuid: ${id}
network: tcp
tls: true
udp: true
flow: xtls-rprx-vision
client-fingerprint: chrome
EOF EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS_Vision)" echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS_Vision)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40${currentHost}%3A${currentDefaultPort}%3Fencryption%3Dnone%26security%3Dtls%26type%3Dtcp%26${currentHost}%3D${currentHost}%26headerType%3Dnone%26sni%3D${currentHost}%26flow%3Dxtls-rprx-vision%23${email}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40${currentHost}%3A${currentDefaultPort}%3Fencryption%3Dnone%26security%3Dtls%26type%3Dtcp%26${currentHost}%3D${currentHost}%26headerType%3Dnone%26sni%3D${currentHost}%26flow%3Dxtls-rprx-vision%23${email}\n"
@ -3438,7 +3453,7 @@ EOF
echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS)" echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS)"
echoContent green " 协议类型:VLESS地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:tcp账户名:${email}\n" echoContent green " 协议类型:VLESS地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:tcp账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
vless://${id}@${currentHost}:${currentDefaultPort}?security=tls&encryption=none&host=${currentHost}&headerType=none&type=tcp#${email} vless://${id}@${currentHost}:${currentDefaultPort}?security=tls&encryption=none&host=${currentHost}&headerType=none&type=tcp#${email}
EOF EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS)" echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS)"
@ -3451,7 +3466,7 @@ EOF
echoContent yellow " ---> 格式化明文(Trojan+TCP+TLS_Vision)" echoContent yellow " ---> 格式化明文(Trojan+TCP+TLS_Vision)"
echoContent green "协议类型:Trojan地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:xtls传输方式:tcpflow:xtls-rprx-vision账户名:${email}\n" echoContent green "协议类型:Trojan地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:xtls传输方式:tcpflow:xtls-rprx-vision账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
trojan://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-vision#${email} trojan://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-vision#${email}
EOF EOF
echoContent yellow " ---> 二维码 Trojan(Trojan+TCP+TLS_Vision)" echoContent yellow " ---> 二维码 Trojan(Trojan+TCP+TLS_Vision)"
@ -3467,8 +3482,26 @@ EOF
echoContent green " vmess://${qrCodeBase64Default}\n" echoContent green " vmess://${qrCodeBase64Default}\n"
echoContent yellow " ---> 二维码 vmess(VMess+WS+TLS)" echoContent yellow " ---> 二维码 vmess(VMess+WS+TLS)"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
vmess://${qrCodeBase64Default} vmess://${qrCodeBase64Default}
EOF
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/clashMeta/${id}"
- name: "${email}"
type: vmess
server: ${currentHost}
port: ${currentDefaultPort}
uuid: ${id}
alterId: 0
cipher: none
udp: true
tls: true
client-fingerprint: chrome
servername: ${currentAdd}
network: ws
ws-opts:
path: /${currentPath}vws
headers:
Host: ${currentHost}
EOF EOF
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vmess://${qrCodeBase64Default}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vmess://${qrCodeBase64Default}\n"
@ -3480,8 +3513,24 @@ EOF
echoContent yellow " ---> 格式化明文(VLESS+WS+TLS)" echoContent yellow " ---> 格式化明文(VLESS+WS+TLS)"
echoContent green " 协议类型:VLESS地址:${currentAdd},伪装域名/SNI:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:ws路径:/${currentPath}ws账户名:${email}\n" echoContent green " 协议类型:VLESS地址:${currentAdd},伪装域名/SNI:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:ws路径:/${currentPath}ws账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
vless://${id}@${currentAdd}:${currentDefaultPort}?encryption=none&security=tls&type=ws&host=${currentHost}&sni=${currentHost}&path=/${currentPath}ws#${email} vless://${id}@${currentAdd}:${currentDefaultPort}?encryption=none&security=tls&type=ws&host=${currentHost}&sni=${currentHost}&path=/${currentPath}ws#${email}
EOF
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/clashMeta/${id}"
- name: "${email}"
type: vless
server: ${currentAdd}
port: ${currentDefaultPort}
uuid: ${id}
udp: true
tls: true
network: ws
client-fingerprint: chrome
servername: ${currentHost}
ws-opts:
path: /${currentPath}ws
headers:
Host: ${currentHost}
EOF EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+WS+TLS)" echoContent yellow " ---> 二维码 VLESS(VLESS+WS+TLS)"
@ -3495,7 +3544,7 @@ EOF
echoContent yellow " ---> 格式化明文(VLESS+gRPC+TLS)" echoContent yellow " ---> 格式化明文(VLESS+gRPC+TLS)"
echoContent green " 协议类型:VLESS地址:${currentAdd},伪装域名/SNI:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:gRPCalpn:h2serviceName:${currentPath}grpc账户名:${email}\n" echoContent green " 协议类型:VLESS地址:${currentAdd},伪装域名/SNI:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:gRPCalpn:h2serviceName:${currentPath}grpc账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
vless://${id}@${currentAdd}:${currentDefaultPort}?encryption=none&security=tls&type=grpc&host=${currentHost}&path=${currentPath}grpc&serviceName=${currentPath}grpc&alpn=h2&sni=${currentHost}#${email} vless://${id}@${currentAdd}:${currentDefaultPort}?encryption=none&security=tls&type=grpc&host=${currentHost}&path=${currentPath}grpc&serviceName=${currentPath}grpc&alpn=h2&sni=${currentHost}#${email}
EOF EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+gRPC+TLS)" echoContent yellow " ---> 二维码 VLESS(VLESS+gRPC+TLS)"
@ -3506,8 +3555,19 @@ EOF
echoContent yellow " ---> Trojan(TLS)" echoContent yellow " ---> Trojan(TLS)"
echoContent green " trojan://${id}@${currentHost}:${currentDefaultPort}?peer=${currentHost}&sni=${currentHost}&alpn=http/1.1#${currentHost}_Trojan\n" echoContent green " trojan://${id}@${currentHost}:${currentDefaultPort}?peer=${currentHost}&sni=${currentHost}&alpn=http/1.1#${currentHost}_Trojan\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
trojan://${id}@${currentHost}:${currentDefaultPort}?peer=${currentHost}&sni=${currentHost}&alpn=http/1.1#${email}_Trojan trojan://${id}@${currentHost}:${currentDefaultPort}?peer=${currentHost}&sni=${currentHost}&alpn=http/1.1#${email}_Trojan
EOF
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/clashMeta/${id}"
- name: "${email}"
type: trojan
server: ${currentHost}
port: ${currentDefaultPort}
password: ${id}
client-fingerprint: chrome
udp: true
sni: ${currentHost}
EOF EOF
echoContent yellow " ---> 二维码 Trojan(TLS)" echoContent yellow " ---> 二维码 Trojan(TLS)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%3a%2f%2f${id}%40${currentHost}%3a${port}%3fpeer%3d${currentHost}%26sni%3d${currentHost}%26alpn%3Dhttp/1.1%23${email}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%3a%2f%2f${id}%40${currentHost}%3a${port}%3fpeer%3d${currentHost}%26sni%3d${currentHost}%26alpn%3Dhttp/1.1%23${email}\n"
@ -3517,8 +3577,20 @@ EOF
echoContent yellow " ---> Trojan gRPC(TLS)" echoContent yellow " ---> Trojan gRPC(TLS)"
echoContent green " trojan://${id}@${currentAdd}:${currentDefaultPort}?encryption=none&peer=${currentHost}&security=tls&type=grpc&sni=${currentHost}&alpn=h2&path=${currentPath}trojangrpc&serviceName=${currentPath}trojangrpc#${email}\n" echoContent green " trojan://${id}@${currentAdd}:${currentDefaultPort}?encryption=none&peer=${currentHost}&security=tls&type=grpc&sni=${currentHost}&alpn=h2&path=${currentPath}trojangrpc&serviceName=${currentPath}trojangrpc#${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
trojan://${id}@${currentAdd}:${currentDefaultPort}?encryption=none&peer=${currentHost}&security=tls&type=grpc&sni=${currentHost}&alpn=h2&path=${currentPath}trojangrpc&serviceName=${currentPath}trojangrpc#${email} trojan://${id}@${currentAdd}:${currentDefaultPort}?encryption=none&peer=${currentHost}&security=tls&type=grpc&sni=${currentHost}&alpn=h2&path=${currentPath}trojangrpc&serviceName=${currentPath}trojangrpc#${email}
EOF
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/clashMeta/${id}"
- name: "${email}"
server: ${currentAdd}
port: ${currentDefaultPort}
type: trojan
password: ${id}
network: grpc
sni: ${currentHost}
udp: true
grpc-opts:
grpc-service-name: "${currentPath}trojangrpc"
EOF EOF
echoContent yellow " ---> 二维码 Trojan gRPC(TLS)" echoContent yellow " ---> 二维码 Trojan gRPC(TLS)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%3a%2f%2f${id}%40${currentAdd}%3a${currentDefaultPort}%3Fencryption%3Dnone%26security%3Dtls%26peer%3d${currentHost}%26type%3Dgrpc%26sni%3d${currentHost}%26path%3D${currentPath}trojangrpc%26alpn%3Dh2%26serviceName%3D${currentPath}trojangrpc%23${email}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%3a%2f%2f${id}%40${currentAdd}%3a${currentDefaultPort}%3Fencryption%3Dnone%26security%3Dtls%26peer%3d${currentHost}%26type%3Dgrpc%26sni%3d${currentHost}%26path%3D${currentPath}trojangrpc%26alpn%3Dh2%26serviceName%3D${currentPath}trojangrpc%23${email}\n"
@ -3528,8 +3600,21 @@ EOF
hysteriaEmail=$(echo "${email}" | awk -F "[_]" '{print $1}')_hysteria hysteriaEmail=$(echo "${email}" | awk -F "[_]" '{print $1}')_hysteria
echoContent yellow " ---> Hysteria(TLS)" echoContent yellow " ---> Hysteria(TLS)"
echoContent green " hysteria://${currentHost}:${hysteriaPort}?protocol=${hysteriaProtocol}&auth=${id}&peer=${currentHost}&insecure=0&alpn=h3&upmbps=${hysteriaClientUploadSpeed}&downmbps=${hysteriaClientDownloadSpeed}#${hysteriaEmail}\n" echoContent green " hysteria://${currentHost}:${hysteriaPort}?protocol=${hysteriaProtocol}&auth=${id}&peer=${currentHost}&insecure=0&alpn=h3&upmbps=${hysteriaClientUploadSpeed}&downmbps=${hysteriaClientDownloadSpeed}#${hysteriaEmail}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
hysteria://${currentHost}:${hysteriaPort}?protocol=${hysteriaProtocol}&auth=${id}&peer=${currentHost}&insecure=0&alpn=h3&upmbps=${hysteriaClientUploadSpeed}&downmbps=${hysteriaClientDownloadSpeed}#${hysteriaEmail} hysteria://${currentHost}:${hysteriaPort}?protocol=${hysteriaProtocol}&auth=${id}&peer=${currentHost}&insecure=0&alpn=h3&upmbps=${hysteriaClientUploadSpeed}&downmbps=${hysteriaClientDownloadSpeed}#${hysteriaEmail}
EOF
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/clashMeta/${id}"
- name: "${hysteriaEmail}"
type: hysteria
server: ${currentHost}
port: ${hysteriaPort}
auth_str: ${id}
alpn:
- h3
protocol: ${hysteriaProtocol}
up: "${hysteriaClientUploadSpeed}"
down: "${hysteriaClientDownloadSpeed}"
sni: ${currentHost}
EOF EOF
echoContent yellow " ---> 二维码 Hysteria(TLS)" echoContent yellow " ---> 二维码 Hysteria(TLS)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=hysteria%3A%2F%2F${currentHost}%3A${hysteriaPort}%3Fprotocol%3D${hysteriaProtocol}%26auth%3D${id}%26peer%3D${currentHost}%26insecure%3D0%26alpn%3Dh3%26upmbps%3D${hysteriaClientUploadSpeed}%26downmbps%3D${hysteriaClientDownloadSpeed}%23${hysteriaEmail}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=hysteria%3A%2F%2F${currentHost}%3A${hysteriaPort}%3Fprotocol%3D${hysteriaProtocol}%26auth%3D${id}%26peer%3D${currentHost}%26insecure%3D0%26alpn%3Dh3%26upmbps%3D${hysteriaClientUploadSpeed}%26downmbps%3D${hysteriaClientDownloadSpeed}%23${hysteriaEmail}\n"
@ -3539,8 +3624,23 @@ EOF
echoContent yellow " ---> 格式化明文(VLESS+reality+uTLS+Vision)" echoContent yellow " ---> 格式化明文(VLESS+reality+uTLS+Vision)"
echoContent green "协议类型:VLESS reality地址:$(getPublicIP)publicKey:${currentRealityPublicKey}serverNames${currentRealityServerNames},端口:${currentRealityPort}用户ID:${id},传输方式:tcp账户名:${email}\n" echoContent green "协议类型:VLESS reality地址:$(getPublicIP)publicKey:${currentRealityPublicKey}serverNames${currentRealityServerNames},端口:${currentRealityPort}用户ID:${id},传输方式:tcp账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
vless://${id}@$(getPublicIP):${currentRealityPort}?encryption=none&security=reality&type=tcp&sni=${currentRealityServerNames}&fp=chrome&pbk=${currentRealityPublicKey}&flow=xtls-rprx-vision#${email} vless://${id}@$(getPublicIP):${currentRealityPort}?encryption=none&security=reality&type=tcp&sni=${currentRealityServerNames}&fp=chrome&pbk=${currentRealityPublicKey}&flow=xtls-rprx-vision#${email}
EOF
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/clashMeta/${id}"
- name: "${email}"
type: vless
server: $(getPublicIP)
port: ${currentRealityPort}
uuid: ${id}
network: tcp
tls: true
udp: true
flow: xtls-rprx-vision
servername: ${currentRealityServerNames}
reality-opts:
public-key: ${currentRealityPublicKey}
client-fingerprint: chrome
EOF EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+reality+uTLS+Vision)" echoContent yellow " ---> 二维码 VLESS(VLESS+reality+uTLS+Vision)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40$(getPublicIP)%3A${currentRealityPort}%3Fencryption%3Dnone%26security%3Dreality%26type%3Dtcp%26sni%3D${currentRealityServerNames}%26fp%3Dchrome%26pbk%3D${currentRealityPublicKey}%26flow%3Dxtls-rprx-vision%23${email}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40$(getPublicIP)%3A${currentRealityPort}%3Fencryption%3Dnone%26security%3Dreality%26type%3Dtcp%26sni%3D${currentRealityServerNames}%26fp%3Dchrome%26pbk%3D${currentRealityPublicKey}%26flow%3Dxtls-rprx-vision%23${email}\n"
@ -3551,8 +3651,24 @@ EOF
echoContent yellow " ---> 格式化明文(VLESS+reality+uTLS+gRPC)" echoContent yellow " ---> 格式化明文(VLESS+reality+uTLS+gRPC)"
echoContent green "协议类型:VLESS realityserviceName:grpc地址:$(getPublicIP)publicKey:${currentRealityPublicKey}serverNames${currentRealityServerNames},端口:${currentRealityPort}用户ID:${id},传输方式:gRPCclient-fingerprintchrome账户名:${email}\n" echoContent green "协议类型:VLESS realityserviceName:grpc地址:$(getPublicIP)publicKey:${currentRealityPublicKey}serverNames${currentRealityServerNames},端口:${currentRealityPort}用户ID:${id},传输方式:gRPCclient-fingerprintchrome账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${id}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/default/${id}"
vless://${id}@$(getPublicIP):${currentRealityPort}?encryption=none&security=reality&type=grpc&sni=${currentRealityServerNames}&fp=chrome&pbk=${currentRealityPublicKey}&path=grpc&serviceName=grpc#${email} vless://${id}@$(getPublicIP):${currentRealityPort}?encryption=none&security=reality&type=grpc&sni=${currentRealityServerNames}&fp=chrome&pbk=${currentRealityPublicKey}&path=grpc&serviceName=grpc#${email}
EOF
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/clashMeta/${id}"
- name: "${email}"
type: vless
server: $(getPublicIP)
port: ${currentRealityPort}
uuid: ${id}
network: grpc
tls: true
udp: true
servername: ${currentRealityServerNames}
reality-opts:
public-key: ${currentRealityPublicKey}
grpc-opts:
grpc-service-name: "grpc"
client-fingerprint: chrome
EOF EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+reality+uTLS+gRPC)" echoContent yellow " ---> 二维码 VLESS(VLESS+reality+uTLS+gRPC)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40$(getPublicIP)%3A${currentRealityPort}%3Fencryption%3Dnone%26security%3Dreality%26type%3Dgrpc%26sni%3D${currentRealityServerNames}%26fp%3Dchrome%26pbk%3D${currentRealityPublicKey}%26path%3Dgrpc%26serviceName%3Dgrpc%23${email}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id}%40$(getPublicIP)%3A${currentRealityPort}%3Fencryption%3Dnone%26security%3Dreality%26type%3Dgrpc%26sni%3D${currentRealityServerNames}%26fp%3Dchrome%26pbk%3D${currentRealityPublicKey}%26path%3Dgrpc%26serviceName%3Dgrpc%23${email}\n"
@ -5855,6 +5971,222 @@ manageAccount() {
fi fi
} }
# clashMeta配置文件
clashMetaConfig() {
local url=$1
local id=$2
cat <<EOF >"/etc/v2ray-agent/subscribe/clashMetaProfiles/${id}"
port: 7890
socks-port: 7891
allow-lan: true
mode: Rule
log-level: debug
external-controller: 127.0.0.1:9090
dns:
enable: true
ipv6: false
listen: 0.0.0.0:53
enhanced-mode: redir-host
nameserver:
- https://doh.pub/dns-query
- tls://dot.pub:853
- https://223.5.5.5/dns-query
- tls://223.5.5.5:853
default-nameserver:
- 114.114.114.114
- 119.29.29.29
- 223.5.5.5
proxy-providers:
provider1:
type: http
path: ./provider1.yaml
url: ${url}
interval: 3600
health-check:
enable: false
url: http://www.gstatic.com/generate_204
interval: 300
proxy-groups:
- name: 节点选择
type: select
use:
- provider1
proxies:
- 自动选择
- 故障转移
- 负载均衡
- DIRECT
- name: 手动切换
type: select
use:
- provider1
proxies: null
- name: 自动选择
type: url-test
url: http://www.gstatic.com/generate_204
interval: 36000
tolerance: 50
use:
- provider1
proxies: null
- name: 故障转移
type: fallback
url: http://www.gstatic.com/generate_204
interval: 300
tolerance: 50
use:
- provider1
proxies:
- 自动选择
- name: 负载均衡
type: load-balance
url: http://www.gstatic.com/generate_204
interval: 300
tolerance: 50
use:
- provider1
proxies: null
- name: 全球代理
type: select
use:
- provider1
proxies:
- 自动选择
- name: Telegram
type: select
use:
- provider1
proxies:
- 自动选择
- 手动切换
- name: YouTube
type: select
use:
- provider1
proxies:
- 自动选择
- 手动切换
- name: Github
type: select
use:
- provider1
proxies:
- 自动选择
- 手动切换
- DIRECT
- name: Google
type: select
use:
- provider1
proxies:
- 自动选择
- 手动切换
- DIRECT
- name: 国内媒体
type: select
use:
- provider1
proxies:
- DIRECT
- name: 本地直连
type: select
use:
- provider1
proxies:
- DIRECT
- 节点选择
- 自动选择
- name: 漏网之鱼
type: select
use:
- provider1
proxies:
- DIRECT
- 节点选择
- 手动切换
- 自动选择
rule-providers:
reject:
type: http
behavior: domain
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/reject.txt
path: ./ruleset/reject.yaml
interval: 86400
proxy:
type: http
behavior: domain
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/proxy.txt
path: ./ruleset/proxy.yaml
interval: 86400
direct:
type: http
behavior: domain
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/direct.txt
path: ./ruleset/direct.yaml
interval: 86400
private:
type: http
behavior: domain
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/private.txt
path: ./ruleset/private.yaml
interval: 86400
gfw:
type: http
behavior: domain
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/gfw.txt
path: ./ruleset/gfw.yaml
interval: 86400
greatfire:
type: http
behavior: domain
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/greatfire.txt
path: ./ruleset/greatfire.yaml
interval: 86400
tld-not-cn:
type: http
behavior: domain
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/tld-not-cn.txt
path: ./ruleset/tld-not-cn.yaml
interval: 86400
telegramcidr:
type: http
behavior: ipcidr
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/telegramcidr.txt
path: ./ruleset/telegramcidr.yaml
interval: 86400
cncidr:
type: http
behavior: ipcidr
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/cncidr.txt
path: ./ruleset/cncidr.yaml
interval: 86400
lancidr:
type: http
behavior: ipcidr
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/lancidr.txt
path: ./ruleset/lancidr.yaml
interval: 86400
applications:
type: http
behavior: classical
url: https://ghproxy.com/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/applications.txt
path: ./ruleset/applications.yaml
interval: 86400
rules:
- GEOIP,LAN,本地直连
- GEOIP,CN,本地直连
- RULE-SET,applications,本地直连
- RULE-SET,direct,本地直连
- RULE-SET,lancidr,本地直连
- RULE-SET,cncidr,本地直连
- RULE-SET,telegramcidr,Telegram
- RULE-SET,proxy,全球代理
- RULE-SET,gfw,全球代理
- MATCH,漏网之鱼
EOF
}
# 订阅 # 订阅
subscribe() { subscribe() {
readInstallProtocolType readInstallProtocolType
@ -5864,29 +6196,44 @@ subscribe() {
echoContent skyBlue "-------------------------备注---------------------------------" echoContent skyBlue "-------------------------备注---------------------------------"
echoContent yellow "# 查看订阅时会重新生成订阅" echoContent yellow "# 查看订阅时会重新生成订阅"
echoContent yellow "# 每次添加、删除账号需要重新查看订阅" echoContent yellow "# 每次添加、删除账号需要重新查看订阅"
rm -rf /etc/v2ray-agent/subscribe/* rm -rf /etc/v2ray-agent/subscribe/default/*
rm -rf /etc/v2ray-agent/subscribe_tmp/* rm -rf /etc/v2ray-agent/subscribe/clashMeta/*
rm -rf /etc/v2ray-agent/subscribe_tmp/default/*
rm -rf /etc/v2ray-agent/subscribe_tmp/clashMeta/*
showAccounts >/dev/null showAccounts >/dev/null
mv /etc/v2ray-agent/subscribe_tmp/* /etc/v2ray-agent/subscribe/ mv /etc/v2ray-agent/subscribe_tmp/* /etc/v2ray-agent/subscribe/
if [[ -n $(ls /etc/v2ray-agent/subscribe/) ]]; then if [[ -n $(ls /etc/v2ray-agent/subscribe/default/) ]]; then
find /etc/v2ray-agent/subscribe/* | while read -r email; do find /etc/v2ray-agent/subscribe/default/* | while read -r email; do
email=$(echo "${email}" | awk -F "[b][e][/]" '{print $2}') email=$(echo "${email}" | awk -F "[d][e][f][a][u][l][t][/]" '{print $2}')
local base64Result local base64Result
base64Result=$(base64 -w 0 "/etc/v2ray-agent/subscribe/${email}") base64Result=$(base64 -w 0 "/etc/v2ray-agent/subscribe/default/${email}")
echo "${base64Result}" >"/etc/v2ray-agent/subscribe/${email}" echo "${base64Result}" >"/etc/v2ray-agent/subscribe/default/${email}"
echoContent skyBlue "--------------------------------------------------------------" echoContent skyBlue "--------------------------------------------------------------"
echoContent yellow "email:${email}\n"
local currentDomain=${currentHost} local currentDomain=${currentHost}
if [[ -n "${currentDefaultPort}" && "${currentDefaultPort}" != "443" ]]; then if [[ -n "${currentDefaultPort}" && "${currentDefaultPort}" != "443" ]]; then
currentDomain="${currentHost}:${currentDefaultPort}" currentDomain="${currentHost}:${currentDefaultPort}"
fi fi
echoContent skyBlue "\n----------默认订阅----------\n"
echoContent yellow "email:${email}\n"
echoContent yellow "url:https://${currentDomain}/s/default/${email}\n"
echoContent yellow "在线二维码:https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=https://${currentDomain}/s/default/${email}\n"
echo "https://${currentDomain}/s/default/${email}" | qrencode -s 10 -m 1 -t UTF8
# clashMeta
if [[ -f "/etc/v2ray-agent/subscribe/clashMeta/${email}" ]]; then
sed -i '1i\proxies:' "/etc/v2ray-agent/subscribe/clashMeta/${email}"
local clashProxyUrl="https://${currentDomain}/s/clashMeta/${email}"
clashMetaConfig "${clashProxyUrl}" "${email}"
echoContent skyBlue "\n----------clashMeta订阅----------\n"
echoContent yellow "url:https://${currentDomain}/s/clashMetaProfiles/${email}\n"
echoContent yellow "在线二维码:https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=https://${currentDomain}/s/clashMetaProfiles/${email}\n"
echo "https://${currentDomain}/s/clashMetaProfiles/${email}" | qrencode -s 10 -m 1 -t UTF8
fi
echoContent yellow "url:https://${currentDomain}/s/${email}\n"
echoContent yellow "在线二维码:https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=https://${currentDomain}/s/${email}\n"
echo "https://${currentDomain}/s/${email}" | qrencode -s 10 -m 1 -t UTF8
echoContent skyBlue "--------------------------------------------------------------" echoContent skyBlue "--------------------------------------------------------------"
done done
fi fi
@ -6145,7 +6492,7 @@ menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v2.8.4" echoContent green "当前版本v2.8.5"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c" echoContent green "描述:八合一共存脚本\c"
showInstallStatus showInstallStatus