mirror of
https://github.com/samuelhbne/proxy-xray.git
synced 2025-12-16 20:27:06 +03:00
Add --lttx --ltrx alias options
This commit is contained in:
28
Dockerfile
28
Dockerfile
@@ -1,29 +1,29 @@
|
||||
FROM golang:1.23-alpine3.20 AS builder
|
||||
|
||||
ARG XRAY_VER='v1.8.23'
|
||||
ARG XRAY_VER='v1.8.24'
|
||||
ARG QREC_VER='4.1.1'
|
||||
|
||||
RUN apk add --no-cache bash git build-base wget
|
||||
RUN apk add --no-cache bash git build-base curl
|
||||
|
||||
RUN cd /tmp; wget -c -t3 -T30 https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
|
||||
RUN cd /tmp; wget -c -t3 -T30 https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
|
||||
WORKDIR /go/src/XTLS/Xray-core
|
||||
RUN git clone https://github.com/XTLS/Xray-core.git . && \
|
||||
git checkout ${XRAY_VER} && \
|
||||
go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main
|
||||
|
||||
RUN cd /tmp; wget -c -t3 -T30 https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf
|
||||
RUN cd /tmp; wget -c -t3 -T30 https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf
|
||||
RUN cd /tmp; wget -c -t3 -T30 https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/bogus-nxdomain.china.conf
|
||||
RUN cd /tmp; wget -c -t3 -T30 https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf
|
||||
|
||||
RUN cd /tmp; wget -c -t3 -T30 https://fukuchi.org/works/qrencode/qrencode-${QREC_VER}.tar.gz && \
|
||||
RUN cd /tmp; curl -O https://fukuchi.org/works/qrencode/qrencode-${QREC_VER}.tar.gz && \
|
||||
tar xvf qrencode-${QREC_VER}.tar.gz && \
|
||||
cd qrencode-${QREC_VER} && \
|
||||
./configure --without-png && \
|
||||
make && \
|
||||
cp -a qrencode /tmp/
|
||||
|
||||
WORKDIR /go/src/XTLS/Xray-core
|
||||
RUN git clone https://github.com/XTLS/Xray-core.git . && \
|
||||
git checkout ${XRAY_VER} && \
|
||||
go build -o xray -trimpath -ldflags "-s -w -buildid=" ./main
|
||||
RUN cd /tmp; curl -O https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat
|
||||
RUN cd /tmp; curl -O https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
|
||||
|
||||
RUN cd /tmp; curl -O https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/apple.china.conf
|
||||
RUN cd /tmp; curl -O https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/google.china.conf
|
||||
RUN cd /tmp; curl -O https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/bogus-nxdomain.china.conf
|
||||
RUN cd /tmp; curl -O https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/accelerated-domains.china.conf
|
||||
|
||||
|
||||
FROM alpine:3.20
|
||||
|
||||
79
README.md
79
README.md
@@ -77,33 +77,36 @@ Xray-URL: vless://myid@mydomain.duckdns.org:443?security=xtls&type=tcp&flow=xtls
|
||||
```shell
|
||||
$ docker run --rm samuelhbne/proxy-xray
|
||||
proxy-xray <connection-options>
|
||||
--lx <VLESS-XTLS option> id@host:port[,s=sniname.org]
|
||||
--ls <VLESS-TLS option> id@host:port[,s=sniname.org]
|
||||
--ms <VMESS-TLS option> id@host:port[,s=sniname.org]
|
||||
--ts <TROJAN-TLS option> password@host:port[,s=sniname.org]
|
||||
--lsg <VLESS-TLS-GRPC option> id@host:port:svcname[,s=sniname.org]
|
||||
--lss <VLESS-TLS-SPLT option> id@host:port:/webpath[,s=sniname.org]
|
||||
--lsw <VLESS-TLS-WS option> id@host:port:/wspath[,s=sniname.org]
|
||||
--msw <VMESS-TLS-WS option> id@host:port:/wspath[,s=sniname.org]
|
||||
--tsw <TROJAN-TLS-WS option> password@host:port:/wspath[,s=sniname.org]
|
||||
--lpg <VLESS-PLN-GRPC option> id@host:port:svcname
|
||||
--lps <VLESS-PLN-SPLT option> id@host:port:/webpath
|
||||
--lpw <VLESS-PLN-WS option> id@host:port:/wspath
|
||||
--mpw <VMESS-PLN-WS option> id@host:port:/wspath
|
||||
--tpw <TROJAN-PLN-WS option> 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 '{"log":{"loglevel":"info"}' Json snippet to merge into the config
|
||||
--dns <upstream-DNS-ip> Designated upstream DNS server IP, 1.1.1.1 will be applied by default
|
||||
--dns-local-cn Enable China-accessible domains to be resolved in China
|
||||
--domain-direct <domain-rule> Add a domain rule for direct routing, likegeosite:geosite:geolocation-cn
|
||||
--domain-proxy <domain-rule> Add a domain rule for proxy routing, like twitter.com or geosite:google-cn
|
||||
--domain-block <domain-rule> Add a domain rule for block routing, like geosite:category-ads-all
|
||||
--ip-direct <ip-rule> Add a ip-addr rule for direct routing, like 114.114.114.114/32 or geoip:cn
|
||||
--ip-proxy <ip-rule> Add a ip-addr rule for proxy routing, like 1.1.1.1/32 or geoip:netflix
|
||||
--ip-block <ip-rule> Add a ip-addr rule for block routing, like geoip:private
|
||||
--cn-direct Add routing rules to avoid domains and IPs located in China being proxied
|
||||
--rules-path <rules-dir-path> Folder path contents geoip.dat, geosite.dat and other rule files
|
||||
--lgp <VLESS-GRPC-PLN option> id@host:port:svcname
|
||||
--lgr <VLESS-GRPC-RLTY option> id@host:port:svcname,d=dest.com,pub=xxxx[,shortId=abcd]
|
||||
--lgt <VLESS-GRPC-TLS option> id@host:port:svcname[,s=sni.com]
|
||||
--lsp <VLESS-SPLT-PLN option> id@host:port:/webpath
|
||||
--lst <VLESS-SPLT-TLS option> id@host:port:/webpath[,s=sni.com]
|
||||
--ltr <VLESS-TCP-RLTY option> id@host:port,d=dest.com,pub=xxxx[,shortId=abcd][,xtls]
|
||||
--ltrx <VLESS-TCP-RLTY-XTLS option> id@host:port,d=dest.com,pub=xxxx[,shortId=abcd]
|
||||
--ltt <VLESS-TCP-TLS option> id@host:port[,s=sni.com][,xtls]
|
||||
--lttx <VLESS-TCP-TLS-XTLS option> id@host:port[,s=sni.com]
|
||||
--lwp <VLESS-WS-PLN option> id@host:port:/wspath
|
||||
--lwt <VLESS-WS-TLS option> id@host:port:/wspath[,s=sni.com]
|
||||
--mtt <VMESS-TCP-TLS option> id@host:port[,s=sni.com]
|
||||
--mwp <VMESS-WS-PLN option> id@host:port:/wspath
|
||||
--mwt <VMESS-WS-TLS option> id@host:port:/wspath[,s=sni.com]
|
||||
--ttt <TROJAN-TCP-TLS option> password@host:port[,s=sni.com]
|
||||
--twp <TROJAN-WS-PLN option> password@host:port:/wspath
|
||||
--twt <TROJAN-WS-TLS option> password@host:port:/wspath[,s=sni.com]
|
||||
-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}'
|
||||
--dns <upstream-DNS-ip> Designated upstream DNS server IP, 1.1.1.1 will be applied by default
|
||||
--dns-local-cn Enable China-accessible domains to be resolved in China
|
||||
--domain-direct <domain-rule> Add a domain rule for direct routing, likegeosite:geosite:geolocation-cn
|
||||
--domain-proxy <domain-rule> Add a domain rule for proxy routing, like twitter.com or geosite:google-cn
|
||||
--domain-block <domain-rule> Add a domain rule for block routing, like geosite:category-ads-all
|
||||
--ip-direct <ip-rule> Add a ip-addr rule for direct routing, like 114.114.114.114/32 or geoip:cn
|
||||
--ip-proxy <ip-rule> Add a ip-addr rule for proxy routing, like 1.1.1.1/32 or geoip:netflix
|
||||
--ip-block <ip-rule> Add a ip-addr rule for block routing, like geoip:private
|
||||
--cn-direct Add routing rules to avoid domains and IPs located in China being proxied
|
||||
--rules-path <rules-dir-path> Folder path contents geoip.dat, geosite.dat and other rule files
|
||||
```
|
||||
|
||||
## How to stop and remove the running container
|
||||
@@ -117,37 +120,37 @@ $ docker rm proxy-xray
|
||||
|
||||
## More complex examples
|
||||
|
||||
### 1. Connect to Vless+TCP+XTLS server
|
||||
### 1. Connect to Vless-TCP-TLS-XTLS server
|
||||
|
||||
The following instruction connect to mydomain.duckdns.org port 443 in Vless+TCP+XTLS mode. Connection made via IP address to avoid DNS contamination. TLS servername provided via parameter. All destination sites and IP located in China will not been proxied.
|
||||
|
||||
```shell
|
||||
$ docker run --name proxy-xray -p 1080:1080 -p 1080:1080/udp -d samuelhbne/proxy-xray \
|
||||
--lx myid@12.34.56.78:443,serverName=mydomain.duckdns.org --cn-direct
|
||||
--lttx myid@12.34.56.78:443,serverName=mydomain.duckdns.org --cn-direct
|
||||
```
|
||||
|
||||
### 2. Connect to Vless+TCP+TLS+Websocket server
|
||||
### 2. Connect to Vless-Websocket-TLS server
|
||||
|
||||
The following instruction connect to Xray server port 443 in Vless+TCP+TLS+Websocket mode with given id. All apple-cn sites will be proxied. All sites located in China will not be proxied.
|
||||
|
||||
```shell
|
||||
$ docker run --name proxy-xray -p 1080:1080 -d samuelhbne/proxy-xray \
|
||||
--lsw myid@mydomain.duckdns.org:443:/websocket \
|
||||
--lwt myid@mydomain.duckdns.org:443:/websocket \
|
||||
--domain-proxy geosite:apple-cn --domain-direct geosite:geolocation-cn
|
||||
```
|
||||
|
||||
### 3. Connect to Vless+TCP+TLS+gRPC server
|
||||
### 3. Connect to Vless-gRPC-TLS server
|
||||
|
||||
The following instruction connect to Xray server port 443 in Vless+TCP+TLS+gRPC mode with given password. All sites not located in China will be proxied. You need to escape '!' character in --domain-proxy parameter to be accepted by shell.
|
||||
The following instruction connect to Xray server port 443 in Vless-gRPC-TLS mode with given password. All sites not located in China will be proxied. You need to escape '!' character in --domain-proxy parameter to be accepted by shell.
|
||||
|
||||
```shell
|
||||
$ docker run --name proxy-xray -p 1080:1080 samuelhbne/proxy-xray \
|
||||
--lsg myid@mydomain.duckdns.org:443:gsvc --domain-proxy geosite:geolocation-\!cn
|
||||
--lgt myid@mydomain.duckdns.org:443:gsvc --domain-proxy geosite:geolocation-\!cn
|
||||
```
|
||||
|
||||
### 4. Connect to TCP+TLS+Trojan server
|
||||
### 4. Connect to TCP-Trojan-TLS server
|
||||
|
||||
The following instruction connect to Xray server port 443 in TCP+TLS+Trojan mode with given password; Update geosite and geoip rule dat files; All sites and IPs located in Iran will be connected directly.
|
||||
The following instruction connect to Xray server port 443 in TCP-Trojan-TLS mode with given password; Update geosite and geoip rule dat files; All sites and IPs located in Iran will be connected directly.
|
||||
|
||||
```shell
|
||||
$ mkdir -p /tmp/rules
|
||||
@@ -156,7 +159,7 @@ $ wget -c -t3 -T30 https://github.com/Loyalsoldier/v2ray-rules-dat/releases/late
|
||||
$ wget -c -t3 -T30 https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat
|
||||
$ wget -c -t3 -T30 https://github.com/SamadiPour/iran-hosted-domains/releases/download/202108210015/iran.dat
|
||||
$ docker run --name proxy-xray -p 1080:1080 -v /tmp/rules:/opt/rules -d samuelhbne/proxy-xray \
|
||||
--ts trojan_pass@mydomain.duckdns.org:8443 \
|
||||
--ttt trojan_pass@mydomain.duckdns.org:8443 \
|
||||
--rules-path /opt/rules --domain-direct ext:iran.dat:ir --ip-direct geoip:ir
|
||||
```
|
||||
|
||||
@@ -166,7 +169,7 @@ The following instruction start proxy-xray in debug mode. Output Xray config fil
|
||||
|
||||
```shell
|
||||
$ docker run --rm -p 1080:1080 samuelhbne/proxy-xray \
|
||||
--msw myid@mydomain.duckdns.org:443:/websocket --debug
|
||||
--mwt myid@mydomain.duckdns.org:443:/websocket --debug
|
||||
```
|
||||
|
||||
### NOTE 4
|
||||
|
||||
@@ -67,6 +67,12 @@ if [ -z "${port}" ]; then
|
||||
port=443
|
||||
fi
|
||||
|
||||
if [ -z "${publicKey}" ]; then
|
||||
>&2 echo "Error: publicKey undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be numeric"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
|
||||
@@ -66,6 +66,12 @@ if [ -z "${port}" ]; then
|
||||
port=443
|
||||
fi
|
||||
|
||||
if [ -z "${publicKey}" ]; then
|
||||
>&2 echo "Error: publicKey undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be numeric"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
|
||||
74
run.sh
74
run.sh
@@ -6,41 +6,43 @@ XCONF=/tmp/proxy-xray.json
|
||||
|
||||
usage() {
|
||||
echo "proxy-xray <connection-options>"
|
||||
echo " --lgp <VLESS-GRPC-PLN option> id@host:port:svcname"
|
||||
echo " --lgr <VLESS-GRPC-RLTY option> id@host:port:svcname,d=dest.com,pub=xxxx[,shortId=abcd]"
|
||||
echo " --lgt <VLESS-GRPC-TLS option> id@host:port:svcname[,s=sni.com]"
|
||||
echo " --lsp <VLESS-SPLT-PLN option> id@host:port:/webpath"
|
||||
echo " --lst <VLESS-SPLT-TLS option> id@host:port:/webpath[,s=sni.com]"
|
||||
echo " --ltr <VLESS-TCP-RLTY option> id@host:port,d=dest.com,pub=xxxx[,shortId=abcd][,xtls]"
|
||||
echo " --ltt <VLESS-TCP-TLS option> id@host:port[,s=sni.com][,xtls]"
|
||||
echo " --lwp <VLESS-WS-PLN option> id@host:port:/wspath"
|
||||
echo " --lwt <VLESS-WS-TLS option> id@host:port:/wspath[,s=sni.com]"
|
||||
echo " --mtt <VMESS-TCP-TLS option> id@host:port[,s=sni.com]"
|
||||
echo " --mwp <VMESS-WS-PLN option> id@host:port:/wspath"
|
||||
echo " --mwt <VMESS-WS-TLS option> id@host:port:/wspath[,s=sni.com]"
|
||||
echo " --ttt <TROJAN-TCP-TLS option> password@host:port[,s=sni.com]"
|
||||
echo " --twp <TROJAN-WS-PLN option> password@host:port:/wspath"
|
||||
echo " --twt <TROJAN-WS-TLS option> password@host:port:/wspath[,s=sni.com]"
|
||||
echo " -d|--debug Start in debug mode with verbose output"
|
||||
echo " -i|--stdin Read config from stdin instead of auto generation"
|
||||
echo " -j|--json '{"log":{"loglevel":"info"}' Json snippet to merge into the config"
|
||||
echo " --dns <upstream-DNS-ip> Designated upstream DNS server IP, 1.1.1.1 will be applied by default"
|
||||
# echo " --dns-local <local-conf-file> Enable designated domain conf file. Like apple.china.conf"
|
||||
echo " --dns-local-cn Enable China-accessible domains to be resolved in China"
|
||||
echo " --domain-direct <domain-rule> Add a domain rule for direct routing, likegeosite:geosite:geolocation-cn"
|
||||
echo " --domain-proxy <domain-rule> Add a domain rule for proxy routing, like twitter.com or geosite:google-cn"
|
||||
echo " --domain-block <domain-rule> Add a domain rule for block routing, like geosite:category-ads-all"
|
||||
echo " --ip-direct <ip-rule> Add a ip-addr rule for direct routing, like 114.114.114.114/32 or geoip:cn"
|
||||
echo " --ip-proxy <ip-rule> Add a ip-addr rule for proxy routing, like 1.1.1.1/32 or geoip:netflix"
|
||||
echo " --ip-block <ip-rule> Add a ip-addr rule for block routing, like geoip:private"
|
||||
echo " --cn-direct Add routing rules to avoid domains and IPs located in China being proxied"
|
||||
echo " --rules-path <rules-dir-path> Folder path contents geoip.dat, geosite.dat and other rule files"
|
||||
echo " --lgp <VLESS-GRPC-PLN option> id@host:port:svcname"
|
||||
echo " --lgr <VLESS-GRPC-RLTY option> id@host:port:svcname,d=dest.com,pub=xxxx[,shortId=abcd]"
|
||||
echo " --lgt <VLESS-GRPC-TLS option> id@host:port:svcname[,s=sni.com]"
|
||||
echo " --lsp <VLESS-SPLT-PLN option> id@host:port:/webpath"
|
||||
echo " --lst <VLESS-SPLT-TLS option> id@host:port:/webpath[,s=sni.com]"
|
||||
echo " --ltr <VLESS-TCP-RLTY option> id@host:port,d=dest.com,pub=xxxx[,shortId=abcd][,xtls]"
|
||||
echo " --ltrx <VLESS-TCP-RLTY-XTLS option> id@host:port,d=dest.com,pub=xxxx[,shortId=abcd]"
|
||||
echo " --ltt <VLESS-TCP-TLS option> id@host:port[,s=sni.com][,xtls]"
|
||||
echo " --lttx <VLESS-TCP-TLS-XTLS option> id@host:port[,s=sni.com]"
|
||||
echo " --lwp <VLESS-WS-PLN option> id@host:port:/wspath"
|
||||
echo " --lwt <VLESS-WS-TLS option> id@host:port:/wspath[,s=sni.com]"
|
||||
echo " --mtt <VMESS-TCP-TLS option> id@host:port[,s=sni.com]"
|
||||
echo " --mwp <VMESS-WS-PLN option> id@host:port:/wspath"
|
||||
echo " --mwt <VMESS-WS-TLS option> id@host:port:/wspath[,s=sni.com]"
|
||||
echo " --ttt <TROJAN-TCP-TLS option> password@host:port[,s=sni.com]"
|
||||
echo " --twp <TROJAN-WS-PLN option> password@host:port:/wspath"
|
||||
echo " --twt <TROJAN-WS-TLS option> password@host:port:/wspath[,s=sni.com]"
|
||||
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"}'"
|
||||
echo " --dns <upstream-DNS-ip> Designated upstream DNS server IP, 1.1.1.1 will be applied by default"
|
||||
# echo " --dns-local <local-conf-file> Enable designated domain conf file. Like apple.china.conf"
|
||||
echo " --dns-local-cn Enable China-accessible domains to be resolved in China"
|
||||
echo " --domain-direct <domain-rule> Add a domain rule for direct routing, likegeosite:geosite:geolocation-cn"
|
||||
echo " --domain-proxy <domain-rule> Add a domain rule for proxy routing, like twitter.com or geosite:google-cn"
|
||||
echo " --domain-block <domain-rule> Add a domain rule for block routing, like geosite:category-ads-all"
|
||||
echo " --ip-direct <ip-rule> Add a ip-addr rule for direct routing, like 114.114.114.114/32 or geoip:cn"
|
||||
echo " --ip-proxy <ip-rule> Add a ip-addr rule for proxy routing, like 1.1.1.1/32 or geoip:netflix"
|
||||
echo " --ip-block <ip-rule> Add a ip-addr rule for block routing, like geoip:private"
|
||||
echo " --cn-direct Add routing rules to avoid domains and IPs located in China being proxied"
|
||||
echo " --rules-path <rules-dir-path> Folder path contents geoip.dat, geosite.dat and other rule files"
|
||||
}
|
||||
|
||||
|
||||
Jrules='{"rules":[]}'
|
||||
|
||||
TEMP=`getopt -o j:di --long lgp:,lgr:,lgt:,lsp:,lst:,ltr:,ltt:,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:,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
|
||||
@@ -56,6 +58,18 @@ while true ; do
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
# Alias options
|
||||
--ltrx|--lttx)
|
||||
subcmd=`echo $1|tr -d '\-\-'|tr -d x`
|
||||
$DIR/proxy-${subcmd}.sh $2,xtls >$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
|
||||
|
||||
Reference in New Issue
Block a user