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:
@@ -116,7 +116,7 @@ server-xray <server-options>
|
||||
-r|--request-domain <domain-name> Domain name to request for letsencrypt cert
|
||||
-c|--cert-home <cert-home-dir> Reading TLS certs from folder <cert-home-dir>/<domain-name>/
|
||||
-i|--stdin Read config from STDIN instead of auto generation
|
||||
-j|--json Json snippet to merge into the config. Say '{log:{loglevel:info}}'
|
||||
-j|--json Json snippet to merge into the config. Say '{"log":{"loglevel":"info"}}'
|
||||
-d|--debug Start in debug mode with verbose output
|
||||
```
|
||||
|
||||
|
||||
5
run.sh
5
run.sh
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
DIR="$(cd $DIR; pwd)"
|
||||
CERTHOME="/opt/cert"
|
||||
XCONF=/tmp/server-xray.json
|
||||
|
||||
@@ -36,7 +35,7 @@ usage() {
|
||||
echo " -r|--request-domain <domain-name> Domain name to request for letsencrypt cert"
|
||||
echo " -c|--cert-home <cert-home-dir> Reading TLS certs from folder <cert-home-dir>/<domain-name>/"
|
||||
echo " -i|--stdin Read config from STDIN instead of auto generation"
|
||||
echo " -j|--json Json snippet to merge into the config. Say '{"log":{"loglevel":"info"}}'"
|
||||
echo " -j|--json Json snippet to merge into the config. Say '{\"log\":{\"loglevel\":\"info\"}}'"
|
||||
echo " -d|--debug Start in debug mode with verbose output"
|
||||
}
|
||||
|
||||
@@ -232,7 +231,7 @@ done
|
||||
if [ -n "${DEBUG}" ]; then loglevel="debug"; else loglevel="warning"; fi
|
||||
Jroot=$(echo $Jroot| jq --arg loglevel "${loglevel}" '.log.loglevel |= $loglevel')
|
||||
|
||||
if [ -n "${INJECT}" ]; then
|
||||
if [ -n "${INJECT[@]}" ]; then
|
||||
for JSON_IN in "${INJECT[@]}"
|
||||
do
|
||||
Jmerge=$(jq -nc "${JSON_IN}")
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "VLESS-GRPC-PLAIN server builder"
|
||||
>&2 echo -e "Usage: server-lgp <s=svcname>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path]"
|
||||
@@ -50,7 +48,7 @@ if [ -z "${serviceName}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -90,7 +88,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "VLESS-GRPC-REALITY server builder"
|
||||
>&2 echo -e "Usage: server-lgr ,<s=svcname>,<d=dest.com>,<prv=yy>,[pub=xx],[shortId=zz],<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
@@ -76,7 +74,7 @@ if [ -z "${serviceName}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -115,7 +113,7 @@ inbound=$(echo $inbound| jq -c --arg dest "${dest}" --arg pubkey "${pubkey}" --a
|
||||
'.streamSettings.realitySettings += {"show":true,"dest":"\($dest):443","serverNames":[$dest],"privateKey":$prvkey,"publicKey":$pubkey}')
|
||||
|
||||
# serverNames settings
|
||||
if [ -n "${serverNames}" ]; then
|
||||
if [ -n "${serverNames[@]}" ]; then
|
||||
JserverNames=$(printf '%s\n' "${serverNames[@]}"|jq -R|jq -sc)
|
||||
inbound=$(echo $inbound| jq -c --argjson JserverNames "${JserverNames}" '.streamSettings.realitySettings.serverNames += $JserverNames')
|
||||
fi
|
||||
@@ -130,7 +128,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "VLESS-GRPC-TLS server builder"
|
||||
>&2 echo -e "Usage: server-lgt <s=svcname>,<c=certhome-dir>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
@@ -64,7 +62,7 @@ if [ -z "${serviceName}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -111,7 +109,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "VLESS-SPLT-PLAIN server builder"
|
||||
>&2 echo -e "Usage: server-lsp <w=webpath>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path]"
|
||||
@@ -50,7 +48,7 @@ if [ -z "${webpath}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -90,7 +88,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "VLESS-SPLT-TLS server builder"
|
||||
>&2 echo -e "Usage: server-lst <w=webpath>,<c=certhome-dir>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
@@ -64,7 +62,7 @@ if [ -z "${webpath}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -111,7 +109,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "VLESS-TCP-REALITY server builder"
|
||||
>&2 echo -e "Usage: server-ltr <d=dest.com>,<prv=yy>,[pub=xx],[shortId=zz],<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
@@ -68,7 +66,7 @@ if [ -z "${prvkey}" ]; then
|
||||
>&2 echo -e "PublicKey: $pubkey\n"
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -107,7 +105,7 @@ inbound=$(echo $inbound| jq -c --arg dest "${dest}" --arg pubkey "${pubkey}" --a
|
||||
'.streamSettings.realitySettings += {"show":true,"dest":"\($dest):443","serverNames":[$dest],"privateKey":$prvkey,"publicKey":$pubkey}')
|
||||
|
||||
# serverNames settings
|
||||
if [ -n "${serverNames}" ]; then
|
||||
if [ -n "${serverNames[@]}" ]; then
|
||||
JserverNames=$(printf '%s\n' "${serverNames[@]}"|jq -R|jq -sc)
|
||||
inbound=$(echo $inbound| jq -c --argjson JserverNames "${JserverNames}" '.streamSettings.realitySettings.serverNames += $JserverNames')
|
||||
fi
|
||||
@@ -122,7 +120,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&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]"
|
||||
@@ -56,7 +54,7 @@ if [ -z "${port}" ]; then
|
||||
usage; exit 1 ;
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -103,7 +101,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -48,7 +48,7 @@ if [ -z "${wspath}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -88,7 +88,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "VLESS-WS-TLS server builder"
|
||||
>&2 echo -e "Usage: server-lwt <w=wskpath>,<c=certhome-dir>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
@@ -64,7 +62,7 @@ if [ -z "${wspath}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -111,7 +109,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "VMESS-TCP-TLS server builder"
|
||||
>&2 echo -e "Usage: server-mtt <c=certhome-dir>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
@@ -56,7 +54,7 @@ if [ -z "${port}" ]; then
|
||||
usage; exit 1 ;
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -103,7 +101,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "VMESS-WS-PLAIN server builder"
|
||||
>&2 echo -e "Usage: server-mwp <w=wskpath>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path]"
|
||||
@@ -50,7 +48,7 @@ if [ -z "${wspath}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -91,7 +89,7 @@ do
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then
|
||||
>&2 echo -e "Incorrect fallback format: ${fallback}\n"
|
||||
>&2 echo -e "Incorrect fallback format: $fb\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
if [ -z "${fhost}" ]; then fhost="127.0.0.1"; fi
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "VMESS-WS-TLS server builder"
|
||||
>&2 echo -e "Usage: server-mwt <w=wskpath>,<c=certhome-dir>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
@@ -64,7 +62,7 @@ if [ -z "${wspath}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -112,7 +110,7 @@ do
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then
|
||||
>&2 echo -e "Incorrect fallback format: ${fallback}\n"
|
||||
>&2 echo -e "Incorrect fallback format: $fb\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
if [ -z "${fhost}" ]; then fhost="127.0.0.1"; fi
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
DIR="$(cd $DIR; pwd)"
|
||||
SITE_TPL="nginx-site.tpl"
|
||||
STREAM_TPL="nginx-stream.tpl"
|
||||
NGCONF="/etc/nginx/nginx.conf"
|
||||
@@ -106,7 +104,7 @@ options=($(echo $STSVR |tr ',' ' '))
|
||||
esac
|
||||
done
|
||||
# Naming the upstream as yahoo_com_jp for SNI yahoo.com.jp
|
||||
upsname=$(echo $sni|sed 's/\./_/g')
|
||||
upsname=$(echo "${sni//\./_}")
|
||||
echo " $sni $upsname;" >>/tmp/stmap.conf
|
||||
echo " upstream $upsname {" >>/tmp/stups.conf
|
||||
echo " server $upstream;" >>/tmp/stups.conf
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "TROJAN-TCP-TLS server builder"
|
||||
>&2 echo -e "Usage: server-ttt <c=certhome-dir>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
@@ -56,7 +54,7 @@ if [ -z "${port}" ]; then
|
||||
usage; exit 1 ;
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -103,7 +101,7 @@ do
|
||||
IFS=':'; fopt=(${fb}); fopt=(${fopt[@]})
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: ${fallback}\n"; usage; exit 1; fi
|
||||
if [ -z "${fport}" ]; then >&2 echo -e "Incorrect fallback format: $fb\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}')
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "TROJAN-WS-PLAIN server builder"
|
||||
>&2 echo -e "Usage: server-twp <w=wskpath>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path]"
|
||||
@@ -50,7 +48,7 @@ if [ -z "${wspath}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -91,7 +89,7 @@ do
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then
|
||||
>&2 echo -e "Incorrect fallback format: ${fallback}\n"
|
||||
>&2 echo -e "Incorrect fallback format: $fb\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
if [ -z "${fhost}" ]; then fhost="127.0.0.1"; fi
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR=$(dirname $0)
|
||||
|
||||
usage() {
|
||||
>&2 echo -e "TROJAN-WS-TLS server builder"
|
||||
>&2 echo -e "Usage: server-twt <w=wskpath>,<c=certhome-dir>,<d=domain.com>,<p=listen-port>,<u=id0>,<u=id1>...,[proxy_acpt],[fallback=host:port:path],[xtls]"
|
||||
@@ -64,7 +62,7 @@ if [ -z "${wspath}" ]; then
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${xuser}" ]; then
|
||||
if [ -z "${xuser[@]}" ]; then
|
||||
>&2 echo -e "Error: User undefined.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
@@ -112,7 +110,7 @@ do
|
||||
fhost="${fopt[0]}"; fport="${fopt[1]}"; fpath="${fopt[2]}"
|
||||
unset IFS
|
||||
if [ -z "${fport}" ]; then
|
||||
>&2 echo -e "Incorrect fallback format: ${fallback}\n"
|
||||
>&2 echo -e "Incorrect fallback format: $fb\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
if [ -z "${fhost}" ]; then fhost="127.0.0.1"; fi
|
||||
|
||||
Reference in New Issue
Block a user