From f5a9174593c78b9832ce0c999586d751df3bbe9d Mon Sep 17 00:00:00 2001 From: Samuel Huang Date: Sat, 21 Sep 2024 23:04:01 +1000 Subject: [PATCH] Add --lst h3 support --- README.md | 25 +++++++++++++------------ run.sh | 39 +++++++++++++++++++++++++++------------ 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index fe355e1..bbd2d62 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,10 @@ $ docker run --name proxy-xray -p 1080:1080 -d samuelhbne/proxy-xray --lttx myid ... ``` -The following command will create a VLESS-SplitHTTP-TLS-HTTP3 client connecting to mydomain.com port 443 with given uid. Expose Socks-proxy port 1080 as a local service. +The following command will create a VLESS-SplitHTTP-TLS-HTTP3 client connecting to mydomain.com port 443 with given uid and webpath. Expose Socks-proxy port 1080 as a local service. ```shell -$ docker run --name proxy-xray -p 1080:1080 -d samuelhbne/proxy-xray --lst myid@mydomain.com:443:/split0,alpn=h3 +$ docker run --name proxy-xray -p 1080:1080 -d samuelhbne/proxy-xray --lsts myid@mydomain.com:443:/split0 ... ``` @@ -80,22 +80,23 @@ Xray-URL: vless://myid@mydomain.duckdns.org:443?security=xtls&type=tcp&flow=xtls $ docker run --rm samuelhbne/proxy-xray proxy-xray --lgp id@host:port:svcname - --lgr id@host:port:svcname,d=dest.com,pub=xxxx[,shortId=abcd] - --lgt id@host:port:svcname[,s=sni.com] + --lgr id@host:port:svcname,d=fakedest.com,pub=xxxx[,shortId=abcd] + --lgt id@host:port:svcname --lsp id@host:port:/webpath - --lst id@host:port:/webpath[,s=sni.com] + --lst id@host:port:/webpath[,alpn=h3] + --lst3 id@host:port:/webpath --ltr id@host:port,d=dest.com,pub=xxxx[,shortId=abcd][,xtls] --ltrx id@host:port,d=dest.com,pub=xxxx[,shortId=abcd] - --ltt id@host:port[,s=sni.com][,xtls] - --lttx id@host:port[,s=sni.com] + --ltt id@host:port[,xtls] + --lttx id@host:port --lwp id@host:port:/wspath - --lwt id@host:port:/wspath[,s=sni.com] - --mtt id@host:port[,s=sni.com] + --lwt id@host:port:/wspath + --mtt id@host:port --mwp id@host:port:/wspath - --mwt id@host:port:/wspath[,s=sni.com] - --ttt password@host:port[,s=sni.com] + --mwt id@host:port:/wspath + --ttt password@host:port --twp password@host:port:/wspath - --twt password@host:port:/wspath[,s=sni.com] + --twt password@host:port:/wspath -d|--debug Start in debug mode with verbose output -i|--stdin Read config from stdin instead of auto generation -j|--json Json snippet to merge into the config. Say '{log:{loglevel:info}' diff --git a/run.sh b/run.sh index 7874010..72f448a 100755 --- a/run.sh +++ b/run.sh @@ -7,22 +7,23 @@ XCONF=/tmp/proxy-xray.json usage() { echo "proxy-xray " echo " --lgp id@host:port:svcname" - echo " --lgr id@host:port:svcname,d=dest.com,pub=xxxx[,shortId=abcd]" - echo " --lgt id@host:port:svcname[,s=sni.com]" + echo " --lgr id@host:port:svcname,d=fakedest.com,pub=xxxx[,shortId=abcd]" + echo " --lgt id@host:port:svcname" echo " --lsp id@host:port:/webpath" - echo " --lst id@host:port:/webpath[,s=sni.com][,alpn=h3]" + echo " --lst id@host:port:/webpath[,alpn=h3]" + echo " --lst3 id@host:port:/webpath" echo " --ltr id@host:port,d=dest.com,pub=xxxx[,shortId=abcd][,xtls]" echo " --ltrx id@host:port,d=dest.com,pub=xxxx[,shortId=abcd]" - echo " --ltt id@host:port[,s=sni.com][,xtls]" - echo " --lttx id@host:port[,s=sni.com]" + echo " --ltt id@host:port[,xtls]" + echo " --lttx id@host:port" echo " --lwp id@host:port:/wspath" - echo " --lwt id@host:port:/wspath[,s=sni.com]" - echo " --mtt id@host:port[,s=sni.com]" + echo " --lwt id@host:port:/wspath" + echo " --mtt id@host:port" echo " --mwp id@host:port:/wspath" - echo " --mwt id@host:port:/wspath[,s=sni.com]" - echo " --ttt password@host:port[,s=sni.com]" + echo " --mwt id@host:port:/wspath" + echo " --ttt password@host:port" echo " --twp password@host:port:/wspath" - echo " --twt password@host:port:/wspath[,s=sni.com]" + echo " --twt password@host:port:/wspath" echo " -d|--debug Start in debug mode with verbose output" 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"}'" @@ -42,7 +43,7 @@ usage() { Jrules='{"rules":[]}' -TEMP=`getopt -o j:di --long lgp:,lgr:,lgt:,lsp:,lst:,ltr:,ltrx:,ltt:,lttx:,lwp:,lwt:,mtt:,mwp:,mwt:,ttt:,twp:,twt:,stdin,debug,dns:,dns-local:,dns-local-cn,domain-direct:,domain-proxy:,domain-block:,ip-direct:,ip-proxy:,ip-block:,cn-direct,rules-path:json: -n "$0" -- $@` +TEMP=`getopt -o j:di --long lgp:,lgr:,lgt:,lsp:,lst:,lst3:,ltr:,ltrx:,ltt:,lttx:,lwp:,lwt:,mtt:,mwp:,mwt:,ttt:,twp:,twt:,stdin,debug,dns:,dns-local:,dns-local-cn,domain-direct:,domain-proxy:,domain-block:,ip-direct:,ip-proxy:,ip-block:,cn-direct,rules-path:json: -n "$0" -- $@` if [ $? != 0 ] ; then usage; exit 1 ; fi eval set -- "$TEMP" while true ; do @@ -59,7 +60,7 @@ while true ; do shift 2 ;; --ltrx|--lttx) - # Alias options + # Alias of --ltr|ltt options subcmd=`echo $1|tr -d '\-\-'|tr -d x` $DIR/proxy-${subcmd}.sh $2,xtls >$XCONF if [ $? != 0 ]; then @@ -70,6 +71,20 @@ while true ; do fi shift 2 ;; + --lst3) + # Alias of --lst options + # splitHTTP is the only option for H3 support from Xray-Core so far. + subcmd=`echo $1|tr -d '\-\-'|tr -d 3` + echo $subcmd + $DIR/proxy-${subcmd}.sh $2,alpn=h3 >$XCONF + if [ $? != 0 ]; then + echo "${subcmd} Config failed: $DIR/proxy-${subcmd}.sh $2" + exit 2 + else + XRAYCFG=1 + fi + shift 2 + ;; --dns) DNS=$2 shift 2