mirror of
https://github.com/samuelhbne/server-xray.git
synced 2025-12-16 20:07:06 +03:00
Codacy compliant
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo "VLESS-TCP-TLS server builder"
|
||||
>&2 echo "Usage: server-ltt <c=certhome-dir>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
>&2 echo "Fallback format: fallback=[host]<:port>[:/path] Like: 'baidu.com:443:/path', ':1443:/path', ':1443'"
|
||||
>&2 echo "User format: user|u=<uid>[:level:email]"
|
||||
>&2 echo -e "VLESS-TCP-TLS server builder"
|
||||
>&2 echo -e "Usage: server-ltt <c=certhome-dir>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
>&2 echo -e "Fallback format: fallback=[host]<:port>[:/path] Like: 'baidu.com:443:/path', ':1443:/path', ':1443'"
|
||||
>&2 echo -e "User format: user|u=<uid>[:level:email]"
|
||||
}
|
||||
|
||||
options=($(echo $1 |tr ',' ' '))
|
||||
@@ -63,8 +63,8 @@ fi
|
||||
|
||||
fullchain="${certhome}/${domain}/fullchain.cer"
|
||||
prvkey="${certhome}/${domain}/${domain}.key"
|
||||
if [ ! -f "${fullchain}" ]; then >&2 echo "Warning, Fullchain not found: ${fullchain}"; fi
|
||||
if [ ! -f "${prvkey}" ]; then >&2 echo "Warning, Private key not found: ${prvkey}"; fi
|
||||
if [ ! -f "${fullchain}" ]; then >&2 echo -e "Warning, Fullchain not found: ${fullchain}\n"; fi
|
||||
if [ ! -f "${prvkey}" ]; then >&2 echo -e "Warning, Private key not found: ${prvkey}\n"; fi
|
||||
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Error: Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
@@ -77,7 +77,7 @@ do
|
||||
IFS=':'; uopt=(${user}); uopt=(${uopt[@]})
|
||||
uid="${uopt[0]}"; level="${uopt[1]}"; email="${uopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${uid}" ]; then >&2 echo "Incorrect user format: $user"; usage; exit 1; fi
|
||||
if [ -z "${uid}" ]; then >&2 echo -e "Incorrect user format: $user\n"; usage; exit 1; fi
|
||||
if [ -z "${level}" ]; then level=0; fi
|
||||
if [ -z "${email}" ]; then email="${uid}@ltt.$domain"; fi
|
||||
inbound=$(echo $inbound| jq -c --arg uid "${uid}" --arg flow "${flow}" --arg level "${level}" --arg email "${email}" \
|
||||
@@ -103,7 +103,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo "Incorrect fallback format: ${fallback}"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fhost}" ]; then fhost="127.0.0.1"; fi
|
||||
fdest="$fhost:$fport"
|
||||
Jfb=$(jq -nc --arg fdest "${fdest}" --arg fpath "${fpath}" '. |= {"dest":$fdest,"path":$fpath,"xver":1}')
|
||||
|
||||
Reference in New Issue
Block a user