mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 完善reality、重构用户读取
parent
6b54f19ba6
commit
052233aa79
146
install.sh
146
install.sh
|
@ -542,7 +542,7 @@ readConfigHostPathUUID() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${coreInstallType}" == "1" && -z "${realityStatus}" ]]; then
|
if [[ "${coreInstallType}" == "1" && -n "${frontingType}" ]]; then
|
||||||
currentHost=$(jq -r .inbounds[0].streamSettings.tlsSettings.certificates[0].certificateFile ${configPath}${frontingType}.json | awk -F '[t][l][s][/]' '{print $2}' | awk -F '[.][c][r][t]' '{print $1}')
|
currentHost=$(jq -r .inbounds[0].streamSettings.tlsSettings.certificates[0].certificateFile ${configPath}${frontingType}.json | awk -F '[t][l][s][/]' '{print $2}' | awk -F '[.][c][r][t]' '{print $1}')
|
||||||
currentAdd=$(jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType}.json)
|
currentAdd=$(jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType}.json)
|
||||||
if [[ "${currentAdd}" == "null" ]]; then
|
if [[ "${currentAdd}" == "null" ]]; then
|
||||||
|
@ -1745,11 +1745,16 @@ installXray() {
|
||||||
version=$(curl -s https://api.github.com/repos/XTLS/Xray-core/releases | jq -r '.[]|select (.prerelease=='${prereleaseStatus}')|.tag_name' | head -1)
|
version=$(curl -s https://api.github.com/repos/XTLS/Xray-core/releases | jq -r '.[]|select (.prerelease=='${prereleaseStatus}')|.tag_name' | head -1)
|
||||||
|
|
||||||
echoContent green " ---> Xray-core版本:${version}"
|
echoContent green " ---> Xray-core版本:${version}"
|
||||||
|
|
||||||
if wget --help | grep -q show-progress; then
|
if wget --help | grep -q show-progress; then
|
||||||
wget -c -q --show-progress -P /etc/v2ray-agent/xray/ "https://github.com/XTLS/Xray-core/releases/download/${version}/${xrayCoreCPUVendor}.zip"
|
wget -c -q --show-progress -P /etc/v2ray-agent/xray/ "https://github.com/XTLS/Xray-core/releases/download/${version}/${xrayCoreCPUVendor}.zip"
|
||||||
else
|
else
|
||||||
wget -c -P /etc/v2ray-agent/xray/ "https://github.com/XTLS/Xray-core/releases/download/${version}/${xrayCoreCPUVendor}.zip" >/dev/null 2>&1
|
wget -c -P /etc/v2ray-agent/xray/ "https://github.com/XTLS/Xray-core/releases/download/${version}/${xrayCoreCPUVendor}.zip" >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
if [[ ! -f "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" ]]; then
|
||||||
|
echoContent red " ---> 核心下载失败,请重新尝试安装"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
unzip -o "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" -d /etc/v2ray-agent/xray >/dev/null
|
unzip -o "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip" -d /etc/v2ray-agent/xray >/dev/null
|
||||||
rm -rf "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip"
|
rm -rf "/etc/v2ray-agent/xray/${xrayCoreCPUVendor}.zip"
|
||||||
|
@ -2226,7 +2231,6 @@ handleXray() {
|
||||||
|
|
||||||
# 读取用户数据并初始化
|
# 读取用户数据并初始化
|
||||||
initXrayClients() {
|
initXrayClients() {
|
||||||
# todo 读取用户信息并统一管理
|
|
||||||
local type=$1
|
local type=$1
|
||||||
local users=[]
|
local users=[]
|
||||||
users=[]
|
users=[]
|
||||||
|
@ -2250,7 +2254,7 @@ initXrayClients() {
|
||||||
currentUser="{\"id\":\"${uuid}\",\"email\":\"${email}-VLESS_WS\"}"
|
currentUser="{\"id\":\"${uuid}\",\"email\":\"${email}-VLESS_WS\"}"
|
||||||
users=$(echo "${users}" | jq -r ". +=[${currentUser}]")
|
users=$(echo "${users}" | jq -r ". +=[${currentUser}]")
|
||||||
fi
|
fi
|
||||||
# trjan grpc
|
# trojan grpc
|
||||||
if echo "${type}" | grep -q "2"; then
|
if echo "${type}" | grep -q "2"; then
|
||||||
currentUser="{\"password\":\"${uuid}\",\"email\":\"${email}-Trojan_gRPC\"}"
|
currentUser="{\"password\":\"${uuid}\",\"email\":\"${email}-Trojan_gRPC\"}"
|
||||||
users=$(echo "${users}" | jq -r ". +=[${currentUser}]")
|
users=$(echo "${users}" | jq -r ". +=[${currentUser}]")
|
||||||
|
@ -2278,23 +2282,22 @@ initXrayClients() {
|
||||||
|
|
||||||
# vless reality vision
|
# vless reality vision
|
||||||
if echo "${type}" | grep -q "7"; then
|
if echo "${type}" | grep -q "7"; then
|
||||||
currentUser="{\"id\":\"${uuid}\",\"email\":\"${email}-vless_reality_vision\"}"
|
currentUser="{\"id\":\"${uuid}\",\"email\":\"${email}-vless_reality_vision\",\"flow\":\"xtls-rprx-vision\"}"
|
||||||
|
|
||||||
users=$(echo "${users}" | jq -r ". +=[${currentUser}]")
|
users=$(echo "${users}" | jq -r ". +=[${currentUser}]")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# vless reality grpc
|
# vless reality grpc
|
||||||
if echo "${type}" | grep -q "8"; then
|
if echo "${type}" | grep -q "8"; then
|
||||||
currentUser="{\"id\":\"${uuid}\",\"email\":\"${email}-vless_reality_grpc\"}"
|
currentUser="{\"id\":\"${uuid}\",\"email\":\"${email}-vless_reality_grpc\",\"flow\":\"\"}"
|
||||||
|
|
||||||
users=$(echo "${users}" | jq -r ". +=[${currentUser}]")
|
users=$(echo "${users}" | jq -r ". +=[${currentUser}]")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done < <(echo "${currentClients}" | jq -c '.[]')
|
done < <(echo "${currentClients}" | jq -c '.[]')
|
||||||
|
echo "${users}"
|
||||||
}
|
}
|
||||||
getClients() {
|
getClients() {
|
||||||
# todo 需要根据不同的类型添加用户
|
|
||||||
local path=$1
|
local path=$1
|
||||||
|
|
||||||
local addClientsStatus=$2
|
local addClientsStatus=$2
|
||||||
|
@ -2894,10 +2897,8 @@ initXrayFrontingConfig() {
|
||||||
|
|
||||||
# 移动上次配置文件至临时文件
|
# 移动上次配置文件至临时文件
|
||||||
movePreviousConfig() {
|
movePreviousConfig() {
|
||||||
# todo 备份02或者07文件中的uuid作为主uuid
|
|
||||||
|
|
||||||
if [[ -n "${configPath}" ]]; then
|
if [[ -n "${configPath}" ]]; then
|
||||||
# todo
|
|
||||||
if [[ -z "${realityStatus}" ]]; then
|
if [[ -z "${realityStatus}" ]]; then
|
||||||
rm -rf "${configPath}../tmp/*" 2>/dev/null
|
rm -rf "${configPath}../tmp/*" 2>/dev/null
|
||||||
mv ${configPath}[0][2-6]* ${configPath}../tmp/ 2>/dev/null
|
mv ${configPath}[0][2-6]* ${configPath}../tmp/ 2>/dev/null
|
||||||
|
@ -2917,15 +2918,14 @@ initXrayConfig() {
|
||||||
local uuid=
|
local uuid=
|
||||||
local addClientsStatus=
|
local addClientsStatus=
|
||||||
if [[ -n "${currentUUID}" ]]; then
|
if [[ -n "${currentUUID}" ]]; then
|
||||||
read -r -p "读取到上次安装记录,是否使用上次安装时的UUID ?[y/n]:" historyUUIDStatus
|
read -r -p "读取到上次用户配置,是否使用上次安装的配置 ?[y/n]:" historyUUIDStatus
|
||||||
if [[ "${historyUUIDStatus}" == "y" ]]; then
|
if [[ "${historyUUIDStatus}" == "y" ]]; then
|
||||||
addClientsStatus=true
|
addClientsStatus=true
|
||||||
uuid=${currentUUID}
|
|
||||||
echoContent green "\n ---> 使用成功"
|
echoContent green "\n ---> 使用成功"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${uuid}" ]]; then
|
if [[ -z "${addClientsStatus}" ]]; then
|
||||||
echoContent yellow "请输入自定义UUID[需合法],[回车]随机UUID"
|
echoContent yellow "请输入自定义UUID[需合法],[回车]随机UUID"
|
||||||
read -r -p 'UUID:' customUUID
|
read -r -p 'UUID:' customUUID
|
||||||
|
|
||||||
|
@ -2937,15 +2937,17 @@ initXrayConfig() {
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${uuid}" ]]; then
|
if [[ -z "${addClientsStatus}" && -z "${uuid}" ]]; then
|
||||||
addClientsStatus=
|
addClientsStatus=
|
||||||
echoContent red "\n ---> uuid读取错误,重新生成"
|
echoContent red "\n ---> uuid读取错误,随机生成"
|
||||||
uuid=$(/etc/v2ray-agent/xray/xray uuid)
|
uuid=$(/etc/v2ray-agent/xray/xray uuid)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echoContent yellow "\n ${uuid}"
|
if [[ -n "${uuid}" ]]; then
|
||||||
|
currentClients='[{"id":"'${uuid}'","add":"'${add}'","flow":"xtls-rprx-vision","email":"default-VLESS_TCP/TLS_Vision"}]'
|
||||||
movePreviousConfig
|
echoContent yellow "\n ${uuid}"
|
||||||
|
fi
|
||||||
|
# movePreviousConfig
|
||||||
|
|
||||||
# log
|
# log
|
||||||
if [[ ! -f "/etc/v2ray-agent/xray/conf/00_log.json" ]]; then
|
if [[ ! -f "/etc/v2ray-agent/xray/conf/00_log.json" ]]; then
|
||||||
|
@ -3045,7 +3047,6 @@ EOF
|
||||||
# trojan
|
# trojan
|
||||||
if echo "${selectCustomInstallType}" | grep -q 4 || [[ "$1" == "all" ]]; then
|
if echo "${selectCustomInstallType}" | grep -q 4 || [[ "$1" == "all" ]]; then
|
||||||
fallbacksList='{"dest":31296,"xver":1},{"alpn":"h2","dest":31302,"xver":0}'
|
fallbacksList='{"dest":31296,"xver":1},{"alpn":"h2","dest":31302,"xver":0}'
|
||||||
getClients "${configPath}../tmp/04_trojan_TCP_inbounds.json" "${addClientsStatus}"
|
|
||||||
cat <<EOF >/etc/v2ray-agent/xray/conf/04_trojan_TCP_inbounds.json
|
cat <<EOF >/etc/v2ray-agent/xray/conf/04_trojan_TCP_inbounds.json
|
||||||
{
|
{
|
||||||
"inbounds":[
|
"inbounds":[
|
||||||
|
@ -3055,12 +3056,7 @@ EOF
|
||||||
"protocol": "trojan",
|
"protocol": "trojan",
|
||||||
"tag":"trojanTCP",
|
"tag":"trojanTCP",
|
||||||
"settings": {
|
"settings": {
|
||||||
"clients": [
|
"clients": $(initXrayClients 4),
|
||||||
{
|
|
||||||
"password": "${uuid}",
|
|
||||||
"email": "default_Trojan_TCP"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fallbacks":[
|
"fallbacks":[
|
||||||
{"dest":"31300"}
|
{"dest":"31300"}
|
||||||
]
|
]
|
||||||
|
@ -3076,13 +3072,11 @@ EOF
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
addClients "${configPath}04_trojan_TCP_inbounds.json" "${addClientsStatus}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# VLESS_WS_TLS
|
# VLESS_WS_TLS
|
||||||
if echo "${selectCustomInstallType}" | grep -q 1 || [[ "$1" == "all" ]]; then
|
if echo "${selectCustomInstallType}" | grep -q 1 || [[ "$1" == "all" ]]; then
|
||||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'ws","dest":31297,"xver":1}'
|
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'ws","dest":31297,"xver":1}'
|
||||||
getClients "${configPath}../tmp/03_VLESS_WS_inbounds.json" "${addClientsStatus}"
|
|
||||||
cat <<EOF >/etc/v2ray-agent/xray/conf/03_VLESS_WS_inbounds.json
|
cat <<EOF >/etc/v2ray-agent/xray/conf/03_VLESS_WS_inbounds.json
|
||||||
{
|
{
|
||||||
"inbounds":[
|
"inbounds":[
|
||||||
|
@ -3092,12 +3086,7 @@ EOF
|
||||||
"protocol": "vless",
|
"protocol": "vless",
|
||||||
"tag":"VLESSWS",
|
"tag":"VLESSWS",
|
||||||
"settings": {
|
"settings": {
|
||||||
"clients": [
|
"clients": $(initXrayClients 1),
|
||||||
{
|
|
||||||
"id": "${uuid}",
|
|
||||||
"email": "default_VLESS_WS"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"decryption": "none"
|
"decryption": "none"
|
||||||
},
|
},
|
||||||
"streamSettings": {
|
"streamSettings": {
|
||||||
|
@ -3112,7 +3101,6 @@ EOF
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
addClients "${configPath}03_VLESS_WS_inbounds.json" "${addClientsStatus}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# trojan_grpc
|
# trojan_grpc
|
||||||
|
@ -3120,7 +3108,6 @@ EOF
|
||||||
if ! echo "${selectCustomInstallType}" | grep -q 5 && [[ -n ${selectCustomInstallType} ]]; then
|
if ! echo "${selectCustomInstallType}" | grep -q 5 && [[ -n ${selectCustomInstallType} ]]; then
|
||||||
fallbacksList=${fallbacksList//31302/31304}
|
fallbacksList=${fallbacksList//31302/31304}
|
||||||
fi
|
fi
|
||||||
getClients "${configPath}../tmp/04_trojan_gRPC_inbounds.json" "${addClientsStatus}"
|
|
||||||
cat <<EOF >/etc/v2ray-agent/xray/conf/04_trojan_gRPC_inbounds.json
|
cat <<EOF >/etc/v2ray-agent/xray/conf/04_trojan_gRPC_inbounds.json
|
||||||
{
|
{
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
|
@ -3130,12 +3117,7 @@ EOF
|
||||||
"protocol": "trojan",
|
"protocol": "trojan",
|
||||||
"tag": "trojangRPCTCP",
|
"tag": "trojangRPCTCP",
|
||||||
"settings": {
|
"settings": {
|
||||||
"clients": [
|
"clients": $(initXrayClients 2),
|
||||||
{
|
|
||||||
"password": "${uuid}",
|
|
||||||
"email": "default_Trojan_gRPC"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"fallbacks": [
|
"fallbacks": [
|
||||||
{
|
{
|
||||||
"dest": "31300"
|
"dest": "31300"
|
||||||
|
@ -3152,13 +3134,11 @@ EOF
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
addClients "${configPath}04_trojan_gRPC_inbounds.json" "${addClientsStatus}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# VMess_WS
|
# VMess_WS
|
||||||
if echo "${selectCustomInstallType}" | grep -q 3 || [[ "$1" == "all" ]]; then
|
if echo "${selectCustomInstallType}" | grep -q 3 || [[ "$1" == "all" ]]; then
|
||||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'vws","dest":31299,"xver":1}'
|
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'vws","dest":31299,"xver":1}'
|
||||||
getClients "${configPath}../tmp/05_VMess_WS_inbounds.json" "${addClientsStatus}"
|
|
||||||
cat <<EOF >/etc/v2ray-agent/xray/conf/05_VMess_WS_inbounds.json
|
cat <<EOF >/etc/v2ray-agent/xray/conf/05_VMess_WS_inbounds.json
|
||||||
{
|
{
|
||||||
"inbounds":[
|
"inbounds":[
|
||||||
|
@ -3168,14 +3148,7 @@ EOF
|
||||||
"protocol": "vmess",
|
"protocol": "vmess",
|
||||||
"tag":"VMessWS",
|
"tag":"VMessWS",
|
||||||
"settings": {
|
"settings": {
|
||||||
"clients": [
|
"clients": $(initXrayClients 3)
|
||||||
{
|
|
||||||
"id": "${uuid}",
|
|
||||||
"alterId": 0,
|
|
||||||
"add": "${add}",
|
|
||||||
"email": "default_VMess_WS"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"streamSettings": {
|
"streamSettings": {
|
||||||
"network": "ws",
|
"network": "ws",
|
||||||
|
@ -3189,11 +3162,9 @@ EOF
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
addClients "${configPath}05_VMess_WS_inbounds.json" "${addClientsStatus}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if echo "${selectCustomInstallType}" | grep -q 5 || [[ "$1" == "all" ]]; then
|
if echo "${selectCustomInstallType}" | grep -q 5 || [[ "$1" == "all" ]]; then
|
||||||
getClients "${configPath}../tmp/06_VLESS_gRPC_inbounds.json" "${addClientsStatus}"
|
|
||||||
cat <<EOF >/etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json
|
cat <<EOF >/etc/v2ray-agent/xray/conf/06_VLESS_gRPC_inbounds.json
|
||||||
{
|
{
|
||||||
"inbounds":[
|
"inbounds":[
|
||||||
|
@ -3203,13 +3174,7 @@ EOF
|
||||||
"protocol": "vless",
|
"protocol": "vless",
|
||||||
"tag":"VLESSGRPC",
|
"tag":"VLESSGRPC",
|
||||||
"settings": {
|
"settings": {
|
||||||
"clients": [
|
"clients": $(initXrayClients 5),
|
||||||
{
|
|
||||||
"id": "${uuid}",
|
|
||||||
"add": "${add}",
|
|
||||||
"email": "default_VLESS_gRPC"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"decryption": "none"
|
"decryption": "none"
|
||||||
},
|
},
|
||||||
"streamSettings": {
|
"streamSettings": {
|
||||||
|
@ -3222,13 +3187,10 @@ EOF
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
addClients "${configPath}06_VLESS_gRPC_inbounds.json" "${addClientsStatus}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# VLESS_TCP/reality
|
# VLESS_TCP/reality
|
||||||
# todo 判断是否不存在读取02
|
|
||||||
if echo "${selectCustomInstallType}" | grep -q 7; then
|
if echo "${selectCustomInstallType}" | grep -q 7; then
|
||||||
getClients "${configPath}../tmp/07_VLESS_vision_reality_inbounds.json" "${addClientsStatus}"
|
|
||||||
local defaultPort=443
|
local defaultPort=443
|
||||||
if [[ -n "${customPort}" ]]; then
|
if [[ -n "${customPort}" ]]; then
|
||||||
defaultPort=${customPort}
|
defaultPort=${customPort}
|
||||||
|
@ -3242,14 +3204,7 @@ EOF
|
||||||
"protocol": "vless",
|
"protocol": "vless",
|
||||||
"tag": "VLESSReality",
|
"tag": "VLESSReality",
|
||||||
"settings": {
|
"settings": {
|
||||||
"clients": [
|
"clients": $(initXrayClients 7),
|
||||||
{
|
|
||||||
"id": "${uuid}",
|
|
||||||
"add": "${add}",
|
|
||||||
"flow": "xtls-rprx-vision",
|
|
||||||
"email": "default_VLESS_reality_Vision"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"decryption": "none",
|
"decryption": "none",
|
||||||
"fallbacks":[
|
"fallbacks":[
|
||||||
{
|
{
|
||||||
|
@ -3280,9 +3235,7 @@ EOF
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
addClients "${configPath}07_VLESS_vision_reality_inbounds.json" "${addClientsStatus}"
|
|
||||||
|
|
||||||
getClients "${configPath}../tmp/08_VLESS_reality_fallback_grpc_inbounds.json" "${addClientsStatus}"
|
|
||||||
cat <<EOF >/etc/v2ray-agent/xray/conf/08_VLESS_reality_fallback_grpc_inbounds.json
|
cat <<EOF >/etc/v2ray-agent/xray/conf/08_VLESS_reality_fallback_grpc_inbounds.json
|
||||||
{
|
{
|
||||||
"inbounds": [
|
"inbounds": [
|
||||||
|
@ -3292,14 +3245,7 @@ EOF
|
||||||
"protocol": "vless",
|
"protocol": "vless",
|
||||||
"tag": "VLESSRealityGRPC",
|
"tag": "VLESSRealityGRPC",
|
||||||
"settings": {
|
"settings": {
|
||||||
"clients": [
|
"clients": $(initXrayClients 8),
|
||||||
{
|
|
||||||
"id": "${uuid}",
|
|
||||||
"add": "${add}",
|
|
||||||
"flow": "",
|
|
||||||
"email": "default_VLESS_grpc_reality"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"decryption": "none"
|
"decryption": "none"
|
||||||
},
|
},
|
||||||
"streamSettings": {
|
"streamSettings": {
|
||||||
|
@ -3317,30 +3263,21 @@ EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
addClients "${configPath}08_VLESS_reality_fallback_grpc_inbounds.json" "${addClientsStatus}"
|
|
||||||
else
|
else
|
||||||
getClients "${configPath}../tmp/02_VLESS_TCP_inbounds.json" "${addClientsStatus}"
|
|
||||||
local defaultPort=443
|
local defaultPort=443
|
||||||
if [[ -n "${customPort}" ]]; then
|
if [[ -n "${customPort}" ]]; then
|
||||||
defaultPort=${customPort}
|
defaultPort=${customPort}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<EOF >/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json
|
cat <<EOF >/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json
|
||||||
{
|
{
|
||||||
"inbounds":[
|
"inbounds":[
|
||||||
{
|
{
|
||||||
"port": ${defaultPort},
|
"port": ${defaultPort},
|
||||||
"protocol": "vless",
|
"protocol": "vless",
|
||||||
"tag":"VLESSTCP",
|
"tag":"VLESSTCP",
|
||||||
"settings": {
|
"settings": {
|
||||||
"clients": [
|
"clients":$(initXrayClients 0),
|
||||||
{
|
|
||||||
"id": "${uuid}",
|
|
||||||
"add":"${add}",
|
|
||||||
"flow":"xtls-rprx-vision",
|
|
||||||
"email": "default_VLESS_TCP/TLS_Vision"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"decryption": "none",
|
"decryption": "none",
|
||||||
"fallbacks": [
|
"fallbacks": [
|
||||||
${fallbacksList}
|
${fallbacksList}
|
||||||
|
@ -3369,7 +3306,6 @@ EOF
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
addClients "${configPath}02_VLESS_TCP_inbounds.json" "${addClientsStatus}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5822,42 +5758,44 @@ switchAlpn() {
|
||||||
|
|
||||||
# 初始化realityKey
|
# 初始化realityKey
|
||||||
initRealityKey() {
|
initRealityKey() {
|
||||||
echoContent skyBlue "\n --->生成key\n"
|
echoContent skyBlue "\n========================== 生成key ==========================\n"
|
||||||
if [[ -n "${currentRealityPublicKey}" ]]; then
|
if [[ -n "${currentRealityPublicKey}" ]]; then
|
||||||
read -r -p "读取到上次安装记录,是否使用上次安装时的PublicKey/PrivateKey ?[y/n]:" historyKeyStatus
|
read -r -p "读取到上次安装记录,是否使用上次安装时的PublicKey/PrivateKey ?[y/n]:" historyKeyStatus
|
||||||
if [[ "${historyKeyStatus}" == "y" ]]; then
|
if [[ "${historyKeyStatus}" == "y" ]]; then
|
||||||
realityPrivateKey=${currentRealityPrivateKey}
|
realityPrivateKey=${currentRealityPrivateKey}
|
||||||
realityPublicKey=${currentRealityPublicKey}
|
realityPublicKey=${currentRealityPublicKey}
|
||||||
else
|
|
||||||
realityX25519Key=$(/etc/v2ray-agent/xray/xray x25519)
|
|
||||||
realityPrivateKey=$(echo "${realityX25519Key}" | head -1 | awk '{print $3}')
|
|
||||||
realityPublicKey=$(echo "${realityX25519Key}" | tail -n 1 | awk '{print $3}')
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [[ -z "${realityPrivateKey}" ]]; then
|
||||||
|
realityX25519Key=$(/etc/v2ray-agent/xray/xray x25519)
|
||||||
|
realityPrivateKey=$(echo "${realityX25519Key}" | head -1 | awk '{print $3}')
|
||||||
|
realityPublicKey=$(echo "${realityX25519Key}" | tail -n 1 | awk '{print $3}')
|
||||||
|
fi
|
||||||
echoContent green "\n privateKey:${realityPrivateKey}"
|
echoContent green "\n privateKey:${realityPrivateKey}"
|
||||||
echoContent green "\n publicKey:${realityPublicKey}"
|
echoContent green "\n publicKey:${realityPublicKey}"
|
||||||
}
|
}
|
||||||
# 初始化reality dest
|
# 初始化reality dest
|
||||||
initRealityDest() {
|
initRealityDest() {
|
||||||
echoContent skyBlue "\n --->生成配置回落的域名 例如:[addons.mozilla.org:443]\n"
|
echoContent skyBlue "\n===== 生成配置回落的域名 例如:[addons.mozilla.org:443] ======\n"
|
||||||
read -r -p "请输入[回车]使用默认:" realityDestDomain
|
read -r -p "请输入[回车]使用默认:" realityDestDomain
|
||||||
if [[ -z "${realityDestDomain}" ]]; then
|
if [[ -z "${realityDestDomain}" ]]; then
|
||||||
realityDestDomain="addons.mozilla.org:443"
|
realityDestDomain="addons.mozilla.org:443"
|
||||||
fi
|
fi
|
||||||
|
echoContent yellow "\n ---> 回落域名: ${realityDestDomain}"
|
||||||
}
|
}
|
||||||
# 初始化客户端可用的ServersName
|
# 初始化客户端可用的ServersName
|
||||||
initRealityClientServersName() {
|
initRealityClientServersName() {
|
||||||
echoContent skyBlue "\n --->配置客户端可用的serverNames"
|
echoContent skyBlue "\n================ 配置客户端可用的serverNames ================\n"
|
||||||
echoContent red "=============================================================="
|
echoContent yellow "#注意事项\n"
|
||||||
echoContent yellow " # 注意事项\n"
|
|
||||||
echoContent yellow "录入示例:addons.mozilla.org\n"
|
echoContent yellow "录入示例:addons.mozilla.org\n"
|
||||||
read -r -p "请输入[回车]使用默认:" realityServerNames
|
read -r -p "请输入[回车]使用默认:" realityServerNames
|
||||||
if [[ -z "${realityDestDomain}" ]]; then
|
if [[ -z "${realityServerNames}" ]]; then
|
||||||
realityServerNames=\"addons.mozilla.org\"
|
realityServerNames=\"addons.mozilla.org\"
|
||||||
else
|
else
|
||||||
realityServerNames=\"${realityServerNames//,/\",\"}\"
|
realityServerNames=\"${realityServerNames//,/\",\"}\"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echoContent yellow "\n ---> 客户端可用域名: ${realityServerNames}\n"
|
||||||
}
|
}
|
||||||
# 初始化reality端口
|
# 初始化reality端口
|
||||||
initRealityPort() {
|
initRealityPort() {
|
||||||
|
@ -5881,7 +5819,7 @@ initRealityPort() {
|
||||||
}
|
}
|
||||||
# 初始化 reality 配置
|
# 初始化 reality 配置
|
||||||
initXrayRealityConfig() {
|
initXrayRealityConfig() {
|
||||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 初始化 Xray-core reality配置"
|
echoContent skyBlue "\n进度 $1/${totalProgress} : 初始化 Xray-core reality配置"
|
||||||
initRealityPort
|
initRealityPort
|
||||||
initRealityKey
|
initRealityKey
|
||||||
initRealityDest
|
initRealityDest
|
||||||
|
|
Loading…
Reference in New Issue