From db75e7ec39601ea91e366dbf6d78f73561166529 Mon Sep 17 00:00:00 2001 From: Samuel Huang Date: Mon, 23 Aug 2021 10:37:45 +1000 Subject: [PATCH] Add -i|--stdin -d|--debug support --- README.md | 10 ++++++---- run.sh | 13 +++++++------ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index f023247..f030946 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ $ docker build -t samuelhbne/server-xray -f Dockerfile.amd64 . ```shell $ docker run --rm -it samuelhbne/server-xray -server-xray -- [-r|--request-domain ] [-c|--cert-path ] [-k|--hook ] + ] -k|--hook [Optional] DDNS update or notifing URL to be hit. Multiple allowed -r|--request-domain [Optional] Domain name to request for letsencrypt cert. Multiple allowed -c|--cert-path [Optional] Reading TLS certs from folder //. Multiple allowed @@ -33,7 +33,8 @@ server-xray -- [-r|--request-domain [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath --ttt [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]] --tttw [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 \ --ltx p=2443,d=mydomain.duckdns.org,u=myid,f=:8080 -r mydomain.duckdns.org @@ -65,8 +66,8 @@ proxy-xray -- [options] --mttw id@host:port:/webpath --ttt password@host:port --tttw password@host:port:/webpath - -d|--debug Start in debug mode with DNS server disabled - --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 proxy-xray -p 1080:1080 -d samuelhbne/proxy-xray \ --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 The following instruction start server-trojan in debug mode. Output Xray config file and the log to console for connection diagnosis. + ```shell $ docker run --rm -p 80:80 -p 443:443 -it samuelhbne/server-xray \ -k https://duckdns.org/update/mydomain/c9711c65-db21-4f8c-a790-2c32c93bde8c \ diff --git a/run.sh b/run.sh index 3a7066d..68695ec 100755 --- a/run.sh +++ b/run.sh @@ -19,10 +19,11 @@ usage() { echo " --tttw [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath" # echo " --ssa [port=443,]user=password1:method1[,user=password2:method2]" # echo " --sst [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 eval set -- "$TEMP" @@ -40,6 +41,10 @@ while true ; do CERTPATH+="$2" shift 2 ;; + -i|--stdin) + STDINCONF=1 + shift 1 + ;; -d|--debug) DEBUG=1 shift 1 @@ -49,10 +54,6 @@ while true ; do SVC=`echo $1|tr -d '\-\-'` SVCMD+=("${DIR}server-${SVC}.sh $2") shift 2 - ;; - --stdin) - STDINCONF=1 - shift 2 ;; --) shift