Add -i|--stdin -d|--debug support

This commit is contained in:
Samuel Huang
2021-08-23 10:37:45 +10:00
parent f045a8d0b9
commit db75e7ec39
2 changed files with 13 additions and 10 deletions

View File

@@ -21,7 +21,7 @@ $ docker build -t samuelhbne/server-xray -f Dockerfile.amd64 .
```shell ```shell
$ docker run --rm -it samuelhbne/server-xray $ docker run --rm -it samuelhbne/server-xray
server-xray --<ltx|ltt|lttw|mtt|mttw|ttt> <options> [-r|--request-domain <domain-name>] [-c|--cert-path <cert-path-root>] [-k|--hook <hook-url>] <hook-url>]
-k|--hook <hook-url> [Optional] DDNS update or notifing URL to be hit. Multiple allowed -k|--hook <hook-url> [Optional] DDNS update or notifing URL to be hit. Multiple allowed
-r|--request-domain <domain-name> [Optional] Domain name to request for letsencrypt cert. Multiple allowed -r|--request-domain <domain-name> [Optional] Domain name to request for letsencrypt cert. Multiple allowed
-c|--cert-path <cert-path-root> [Optional] Reading TLS certs from folder <cert-path-root>/<domain-name>/. Multiple allowed -c|--cert-path <cert-path-root> [Optional] Reading TLS certs from folder <cert-path-root>/<domain-name>/. Multiple allowed
@@ -33,7 +33,8 @@ server-xray --<ltx|ltt|lttw|mtt|mttw|ttt> <options> [-r|--request-domain <domain
--mttw <VMESS-TCP-TLS-WS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath --mttw <VMESS-TCP-TLS-WS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath
--ttt <TROJAN-TCP-TLS option> [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]] --ttt <TROJAN-TCP-TLS option> [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]]
--tttw <TROJAN-TCP-TLS-WS option> [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath --tttw <TROJAN-TCP-TLS-WS option> [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath
--stdin Read XRay config from stdin instead of auto generation -i|--stdin Read XRay config from stdin instead of auto generation
-d|--debug Start Xray in debug mode with verbose output
$ docker run --name server-xray -p 80:80 -p 443:2443 -d samuelhbne/server-xray \ $ docker run --name server-xray -p 80:80 -p 443:2443 -d samuelhbne/server-xray \
--ltx p=2443,d=mydomain.duckdns.org,u=myid,f=:8080 -r mydomain.duckdns.org --ltx p=2443,d=mydomain.duckdns.org,u=myid,f=:8080 -r mydomain.duckdns.org
@@ -65,8 +66,8 @@ proxy-xray --<ltx|ltt|lttw|mtt|mttw|ttt|tttw|ssa|sst|stdin> [options]
--mttw <VMESS-TCP-TLS-WS option> id@host:port:/webpath --mttw <VMESS-TCP-TLS-WS option> id@host:port:/webpath
--ttt <TROJAN-TCP-TLS option> password@host:port --ttt <TROJAN-TCP-TLS option> password@host:port
--tttw <TROJAN-TCP-TLS-WS option> password@host:port:/webpath --tttw <TROJAN-TCP-TLS-WS option> password@host:port:/webpath
-d|--debug Start in debug mode with DNS server disabled -i|--stdin Read XRay config from stdin instead of auto generation
--stdin Read XRay config from stdin instead of auto generation -d|--debug Start Xray in debug mode with verbose output
$ docker run --name proxy-xray -p 1080:1080 -d samuelhbne/proxy-xray \ $ docker run --name proxy-xray -p 1080:1080 -d samuelhbne/proxy-xray \
--ltx myid@mydomain.duckdns.org:443 --ltx myid@mydomain.duckdns.org:443
@@ -217,6 +218,7 @@ Xray-URL: vless://myid@mydomain.duckdns.org:443?security=tls&type=grpc&serviceNa
### 4. Running server-ray container in debug mode for connection issue diagnosis ### 4. Running server-ray container in debug mode for connection issue diagnosis
The following instruction start server-trojan in debug mode. Output Xray config file and the log to console for connection diagnosis. The following instruction start server-trojan in debug mode. Output Xray config file and the log to console for connection diagnosis.
```shell ```shell
$ docker run --rm -p 80:80 -p 443:443 -it samuelhbne/server-xray \ $ docker run --rm -p 80:80 -p 443:443 -it samuelhbne/server-xray \
-k https://duckdns.org/update/mydomain/c9711c65-db21-4f8c-a790-2c32c93bde8c \ -k https://duckdns.org/update/mydomain/c9711c65-db21-4f8c-a790-2c32c93bde8c \

13
run.sh
View File

@@ -19,10 +19,11 @@ usage() {
echo " --tttw <TROJAN-TCP-TLS-WS option> [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath" echo " --tttw <TROJAN-TCP-TLS-WS option> [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath"
# echo " --ssa <Shadowsocks-AEAD option> [port=443,]user=password1:method1[,user=password2:method2]" # echo " --ssa <Shadowsocks-AEAD option> [port=443,]user=password1:method1[,user=password2:method2]"
# echo " --sst <Shadowsocks-TCP option> [port=443,]user=passwd,method=xxxx" # echo " --sst <Shadowsocks-TCP option> [port=443,]user=passwd,method=xxxx"
echo " --stdin Read XRay config from stdin instead of auto generation" echo " -i|--stdin Read XRay config from stdin instead of auto generation"
echo " -d|--debug Start Xray in debug mode with verbose output"
} }
TEMP=`getopt -o k:r:c:d --long hook:,request-domain:,cert-path:,ltx:,ltt:,lttw:,mtt:,mttw:,ttt:,tttw:,lttg:,ssa:,sst:stdin,debug -n "$0" -- $@` TEMP=`getopt -o k:r:c:di --long hook:,request-domain:,cert-path:,ltx:,ltt:,lttw:,mtt:,mttw:,ttt:,tttw:,lttg:,ssa:,sst:stdin,debug -n "$0" -- $@`
if [ $? != 0 ] ; then usage; exit 1 ; fi if [ $? != 0 ] ; then usage; exit 1 ; fi
eval set -- "$TEMP" eval set -- "$TEMP"
@@ -40,6 +41,10 @@ while true ; do
CERTPATH+="$2" CERTPATH+="$2"
shift 2 shift 2
;; ;;
-i|--stdin)
STDINCONF=1
shift 1
;;
-d|--debug) -d|--debug)
DEBUG=1 DEBUG=1
shift 1 shift 1
@@ -49,10 +54,6 @@ while true ; do
SVC=`echo $1|tr -d '\-\-'` SVC=`echo $1|tr -d '\-\-'`
SVCMD+=("${DIR}server-${SVC}.sh $2") SVCMD+=("${DIR}server-${SVC}.sh $2")
shift 2 shift 2
;;
--stdin)
STDINCONF=1
shift 2
;; ;;
--) --)
shift shift