Port number issue fix, streamSettings position fix

This commit is contained in:
Samuel Huang
2024-09-24 14:16:28 +10:00
parent 5562f3c0ce
commit bdeab3bdfa
15 changed files with 74 additions and 74 deletions

View File

@@ -77,7 +77,7 @@ if [ ! -f "${prvkey}" ]; then >&2 echo "Warning, Private key not found: ${prvkey
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be numeric"; exit 1; fi
# inbound frame
inbound=`jq -nc --arg port "${port}" '{"port":$port,"protocol":"trojan","settings":{"decryption":"none"}}'`
inbound=`jq -nc --arg port "${port}" '{"port":($port|tonumber),"protocol":"trojan","settings":{"decryption":"none"}}'`
# User settings
for user in "${xuser[@]}"
@@ -94,16 +94,16 @@ done
# StreamSettings
if [ -n "${acceptProxyProtocol}" ]; then
inbound=`echo $inbound| jq -c '.settings.streamSettings.sockopt += {"acceptProxyProtocol":true}'`
inbound=`echo $inbound| jq -c '.streamSettings.sockopt += {"acceptProxyProtocol":true}'`
fi
# Network settings
inbound=`echo $inbound| jq -c --arg wspath "${wspath}" '.settings.streamSettings += {"network":"ws","wsSettings":{"path":$wspath}}'`
inbound=`echo $inbound| jq -c --arg wspath "${wspath}" '.streamSettings += {"network":"ws","wsSettings":{"path":$wspath}}'`
# Security settings
inbound=`echo $inbound| jq -c '.settings.streamSettings += {"security":"tls"}'`
inbound=`echo $inbound| jq -c '.streamSettings += {"security":"tls"}'`
inbound=`echo $inbound| jq -c --arg fullchain "${fullchain}" --arg prvkey "${prvkey}" \
'.settings.streamSettings.tlsSettings += {"certificates":[{"certificateFile":$fullchain,"keyFile":$prvkey}]}'`
'.streamSettings.tlsSettings += {"certificates":[{"certificateFile":$fullchain,"keyFile":$prvkey}]}'`
# Fallback settings
for fb in "${fallback[@]}"