Initial SPLT support

This commit is contained in:
Samuel Huang
2024-08-25 20:01:32 +10:00
parent 1baebe117a
commit fe58d3e0fd
17 changed files with 219 additions and 83 deletions

View File

@@ -46,18 +46,23 @@ RUN apk --no-cache add bash openssl curl jq moreutils \
RUN sed -i "s/^socks4.*/socks5\t127.0.0.1 1080/g" /etc/proxychains/proxychains.conf RUN sed -i "s/^socks4.*/socks5\t127.0.0.1 1080/g" /etc/proxychains/proxychains.conf
ADD proxy-ltx.sh /proxy-ltx.sh ADD proxy-lx.sh /proxy-lx.sh
ADD proxy-ltt.sh /proxy-ltt.sh ADD proxy-ls.sh /proxy-ls.sh
ADD proxy-ltpw.sh /proxy-ltpw.sh ADD proxy-ms.sh /proxy-ms.sh
ADD proxy-lttw.sh /proxy-lttw.sh ADD proxy-ts.sh /proxy-ts.sh
ADD proxy-ltpg.sh /proxy-ltpg.sh
ADD proxy-lttg.sh /proxy-lttg.sh ADD proxy-lsg.sh /proxy-lsg.sh
ADD proxy-mtt.sh /proxy-mtt.sh ADD proxy-lss.sh /proxy-lss.sh
ADD proxy-mtpw.sh /proxy-mtpw.sh ADD proxy-lsw.sh /proxy-lsw.sh
ADD proxy-mttw.sh /proxy-mttw.sh ADD proxy-msw.sh /proxy-msw.sh
ADD proxy-ttt.sh /proxy-ttt.sh ADD proxy-tsw.sh /proxy-tsw.sh
ADD proxy-ttpw.sh /proxy-ttpw.sh
ADD proxy-tttw.sh /proxy-tttw.sh ADD proxy-lpg.sh /proxy-lpg.sh
ADD proxy-lps.sh /proxy-lps.sh
ADD proxy-lpw.sh /proxy-lpw.sh
ADD proxy-mpw.sh /proxy-mpw.sh
ADD proxy-tpw.sh /proxy-tpw.sh
ADD status.sh /status.sh ADD status.sh /status.sh
ADD run.sh /run.sh ADD run.sh /run.sh

View File

@@ -17,7 +17,7 @@ The following command will:
```shell ```shell
$ docker run --name proxy-xray -p 2080:1080 -p 2080:1080/udp -p 8223:8123 -p 65353:53/udp \ $ docker run --name proxy-xray -p 2080:1080 -p 2080:1080/udp -p 8223:8123 -p 65353:53/udp \
-d samuelhbne/proxy-xray --ltx myid@mydomain.duckdns.org:443 --cn-direct --dns-local-cn -d samuelhbne/proxy-xray --lx myid@mydomain.duckdns.org:443 --cn-direct --dns-local-cn
... ...
``` ```
@@ -76,30 +76,32 @@ Xray-URL: vless://myid@mydomain.duckdns.org:443?security=xtls&type=tcp&flow=xtls
```shell ```shell
$ docker run --rm samuelhbne/proxy-xray $ docker run --rm samuelhbne/proxy-xray
proxy-xray <connection-options> proxy-xray <connection-options>
--ltx <VLESS-TCP-XTLS option> id@host:port[,s=sniname.org] --lx <VLESS-XTLS option> id@host:port[,s=sniname.org]
--ltt <VLESS-TCP-TLS option> id@host:port[,s=sniname.org] --ls <VLESS-TLS option> id@host:port[,s=sniname.org]
--ltpw <VLESS-TCP-PLAIN-WS option> id@host:port:/webpath --ms <VMESS-TLS option> id@host:port[,s=sniname.org]
--lttw <VLESS-TCP-TLS-WS option> id@host:port:/webpath[,s=sniname.org] --ts <TROJAN-TLS option> password@host:port[,s=sniname.org]
--ltpg <VLESS-TCP-PLAIN-GRPC option> id@host:port:svcname --lsg <VLESS-TLS-GRPC option> id@host:port:svcname[,s=sniname.org]
--lttg <VLESS-TCP-TLS-GRPC option> id@host:port:svcname[,s=sniname.org] --lss <VLESS-TLS-SPLT option> id@host:port:/webpath[,s=sniname.org]
--mtt <VMESS-TCP-TLS option> id@host:port[,s=sniname.org] --lsw <VLESS-TLS-WS option> id@host:port:/wspath[,s=sniname.org]
--mtpw <VMESS-TCP-PLAIN-WS option> id@host:port:/webpath --msw <VMESS-TLS-WS option> id@host:port:/wspath[,s=sniname.org]
--mttw <VMESS-TCP-TLS-WS option> id@host:port:/webpath[,s=sniname.org] --tsw <TROJAN-TLS-WS option> password@host:port:/wspath[,s=sniname.org]
--ttt <TROJAN-TCP-TLS option> password@host:port[,s=sniname.org] --lpg <VLESS-PLN-GRPC option> id@host:port:svcname
--ttpw <TROJAN-TCP-PLAIN-WS option> password@host:port:/webpath --lps <VLESS-PLN-SPLT option> id@host:port:/webpath
--tttw <TROJAN-TCP-TLS-WS option> password@host:port:/webpath[,s=sniname.org] --lpw <VLESS-PLN-WS option> id@host:port:/wspath
-d|--debug [Optional] Start in debug mode with verbose output --mpw <VMESS-PLN-WS option> id@host:port:/wspath
-i|--stdin [Optional] Read config from stdin instead of auto generation --tpw <TROJAN-PLN-WS option> password@host:port:/wspath
--dns <upstream-DNS-ip> [Optional] Designated upstream DNS server IP, 1.1.1.1 will be applied by default -d|--debug Start in debug mode with verbose output
--dns-local-cn [Optional] Enable China-accessible domains to be resolved in China -i|--stdin Read config from stdin instead of auto generation
--domain-direct <domain-rule> [Optional] Add a domain rule for direct routing, likegeosite:geosite:geolocation-cn --dns <upstream-DNS-ip> Designated upstream DNS server IP, 1.1.1.1 will be applied by default
--domain-proxy <domain-rule> [Optional] Add a domain rule for proxy routing, like twitter.com or geosite:google-cn --dns-local-cn Enable China-accessible domains to be resolved in China
--domain-block <domain-rule> [Optional] Add a domain rule for block routing, like geosite:category-ads-all --domain-direct <domain-rule> Add a domain rule for direct routing, likegeosite:geosite:geolocation-cn
--ip-direct <ip-rule> [Optional] Add a ip-addr rule for direct routing, like 114.114.114.114/32 or geoip:cn --domain-proxy <domain-rule> Add a domain rule for proxy routing, like twitter.com or geosite:google-cn
--ip-proxy <ip-rule> [Optional] Add a ip-addr rule for proxy routing, like 1.1.1.1/32 or geoip:netflix --domain-block <domain-rule> Add a domain rule for block routing, like geosite:category-ads-all
--ip-block <ip-rule> [Optional] Add a ip-addr rule for block routing, like geoip:private --ip-direct <ip-rule> Add a ip-addr rule for direct routing, like 114.114.114.114/32 or geoip:cn
--cn-direct [Optional] Add routing rules to avoid domains and IPs located in China being proxied --ip-proxy <ip-rule> Add a ip-addr rule for proxy routing, like 1.1.1.1/32 or geoip:netflix
--rules-path <rules-dir-path> [Optional] Folder path contents geoip.dat, geosite.dat and other rule files --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 ## How to stop and remove the running container
@@ -119,7 +121,7 @@ The following instruction connect to mydomain.duckdns.org port 443 in Vless+TCP+
```shell ```shell
$ docker run --name proxy-xray -p 1080:1080 -p 1080:1080/udp -d samuelhbne/proxy-xray \ $ docker run --name proxy-xray -p 1080:1080 -p 1080:1080/udp -d samuelhbne/proxy-xray \
--ltx myid@12.34.56.78:443,serverName=mydomain.duckdns.org --cn-direct --lx myid@12.34.56.78:443,serverName=mydomain.duckdns.org --cn-direct
``` ```
### 2. Connect to Vless+TCP+TLS+Websocket server ### 2. Connect to Vless+TCP+TLS+Websocket server
@@ -128,7 +130,7 @@ The following instruction connect to Xray server port 443 in Vless+TCP+TLS+Webso
```shell ```shell
$ docker run --name proxy-xray -p 1080:1080 -d samuelhbne/proxy-xray \ $ docker run --name proxy-xray -p 1080:1080 -d samuelhbne/proxy-xray \
--lttw myid@mydomain.duckdns.org:443:/websocket \ --lsw myid@mydomain.duckdns.org:443:/websocket \
--domain-proxy geosite:apple-cn --domain-direct geosite:geolocation-cn --domain-proxy geosite:apple-cn --domain-direct geosite:geolocation-cn
``` ```
@@ -138,7 +140,7 @@ The following instruction connect to Xray server port 443 in Vless+TCP+TLS+gRPC
```shell ```shell
$ docker run --name proxy-xray -p 1080:1080 samuelhbne/proxy-xray \ $ docker run --name proxy-xray -p 1080:1080 samuelhbne/proxy-xray \
--lttg myid@mydomain.duckdns.org:443:gsvc --domain-proxy geosite:geolocation-\!cn --lsg myid@mydomain.duckdns.org:443:gsvc --domain-proxy geosite:geolocation-\!cn
``` ```
### 4. Connect to TCP+TLS+Trojan server ### 4. Connect to TCP+TLS+Trojan server
@@ -152,7 +154,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/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 $ 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 \ $ docker run --name proxy-xray -p 1080:1080 -v /tmp/rules:/opt/rules -d samuelhbne/proxy-xray \
--ttt trojan_pass@mydomain.duckdns.org:8443 \ --ts trojan_pass@mydomain.duckdns.org:8443 \
--rules-path /opt/rules --domain-direct ext:iran.dat:ir --ip-direct geoip:ir --rules-path /opt/rules --domain-direct ext:iran.dat:ir --ip-direct geoip:ir
``` ```
@@ -162,7 +164,7 @@ The following instruction start proxy-xray in debug mode. Output Xray config fil
```shell ```shell
$ docker run --rm -p 1080:1080 samuelhbne/proxy-xray \ $ docker run --rm -p 1080:1080 samuelhbne/proxy-xray \
--mttw myid@mydomain.duckdns.org:443:/websocket --debug --msw myid@mydomain.duckdns.org:443:/websocket --debug
``` ```
### NOTE 4 ### NOTE 4

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-ltpg <id@domain.com:80:/svcpath>" >&2 echo "Usage: proxy-lpg <id@domain.com:80:/svcpath>"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

56
proxy-lps.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
usage() {
>&2 echo "Usage: proxy-lps <id@domain.com:80:/webpath>"
}
if [ -z "$1" ]; then
>&2 echo "Missing options"
usage
exit 1
fi
# id@domain.com:443:/webpath
options=(`echo $1 |tr '@' ' '`)
id="${options[0]}"
options=(`echo ${options[1]} |tr ':' ' '`)
host="${options[0]}"
port="${options[1]}"
path="${options[2]}"
if [ -z "${id}" ]; then
>&2 echo "Error: uuid undefined."
usage
exit 1
fi
if [ -z "${host}" ]; then
>&2 echo "Error: destination host undefined."
usage
exit 1
fi
if [ -z "${port}" ]; then
port=80
fi
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be numeric"; exit 1; fi
Jusers=`echo '{}' |jq --arg uuid "${id}" '. += {"id":$uuid, "encryption":"none", "level":0}'`
Jvnext=`echo '{}' | jq --arg host "${host}" --arg port "${port}" --argjson juser "${Jusers}" \
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
JstreamSettings=`echo '{}' | jq --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" \
'. += {"network":"splithttp", "security":"none", "splithttpSettings":{"path":$path}}' `
Jproxy=`echo '{}' | jq --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
'. += { "tag": "proxy", "protocol":"vless", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
Jdirect='{"tag": "direct", "protocol": "freedom", "settings": {}}'
Jblocked='{"tag": "blocked", "protocol": "blackhole", "settings": {}}'
jroot=`echo '{}' | jq --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
'. += {"log":{"loglevel":"warning"}, "outbounds":[$jproxy, $jdirect, $jblocked]}' `
echo "$jroot"
exit 0

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-ltpw <id@domain.com:80:/websocket>" >&2 echo "Usage: proxy-lpw <id@domain.com:80:/websocket>"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-ltt <id@domain.com:443>[,serverName=x.org][,fingerprint=safari]" >&2 echo "Usage: proxy-ls <id@domain.com:443>[,serverName=x.org][,fingerprint=safari]"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-lttg <id@domain.com:443:/svcpath>[,serverName=x.org][,fingerprint=safari]" >&2 echo "Usage: proxy-lsg <id@domain.com:443:/svcpath>[,serverName=x.org][,fingerprint=safari]"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

73
proxy-lss.sh Executable file
View File

@@ -0,0 +1,73 @@
#!/bin/bash
usage() {
>&2 echo "Usage: proxy-lss <id@domain.com:443:/webpath>[,serverName=x.org][,fingerprint=safari]"
}
if [ -z "$1" ]; then
>&2 echo "Missing options"
usage
exit 1
fi
# id@domain.com:443:/webpath,serverName=x.org,fingerprint=safari
args=(`echo $1 |tr ',' ' '`)
dest="${args[0]}"
for ext_opt in "${args[@]}"
do
kv=(`echo $ext_opt |tr '=' ' '`)
case "${kv[0]}" in
s|serverName)
serverName="${kv[1]}"
;;
f|fingerprint)
fingerprint="${kv[1]}"
;;
esac
done
options=(`echo $dest |tr '@' ' '`)
id="${options[0]}"
options=(`echo ${options[1]} |tr ':' ' '`)
host="${options[0]}"
port="${options[1]}"
path="${options[2]}"
if [ -z "${serverName}" ]; then serverName=${host}; fi
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
if [ -z "${id}" ]; then
>&2 echo "Error: uuid undefined."
usage
exit 1
fi
if [ -z "${host}" ]; then
>&2 echo "Error: destination host undefined."
usage
exit 1
fi
if [ -z "${port}" ]; then
port=443
fi
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be numeric"; exit 1; fi
Jusers=`echo '{}' |jq --arg uuid "${id}" '. += {"id":$uuid, "encryption":"none", "level":0}'`
Jvnext=`echo '{}' | jq --arg host "${host}" --arg port "${port}" --argjson juser "${Jusers}" \
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
JstreamSettings=`echo '{}' | jq --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" \
'. += {"network":"splithttp", "security":"tls", "tlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}, "splithttpSettings":{"path":$path}}' `
Jproxy=`echo '{}' | jq --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
'. += { "tag": "proxy", "protocol":"vless", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
Jdirect='{"tag": "direct", "protocol": "freedom", "settings": {}}'
Jblocked='{"tag": "blocked", "protocol": "blackhole", "settings": {}}'
jroot=`echo '{}' | jq --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
'. += {"log":{"loglevel":"warning"}, "outbounds":[$jproxy, $jdirect, $jblocked]}' `
echo "$jroot"
exit 0

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-lttw <id@domain.com:443:/websocket>[,serverName=x.org][,fingerprint=safari]" >&2 echo "Usage: proxy-lsw <id@domain.com:443:/websocket>[,serverName=x.org][,fingerprint=safari]"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-ltx <id@domain.com:443>[,serverName=x.org][,fingerprint=safari]" >&2 echo "Usage: proxy-lx <id@domain.com:443>[,serverName=x.org][,fingerprint=safari]"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-mtpw <id@domain.com:443:/websocket>" >&2 echo "Usage: proxy-mpw <id@domain.com:443:/websocket>"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-mtt <id@domain.com:443>[,serverName=x.org][,fingerprint=safari]" >&2 echo "Usage: proxy-ms <id@domain.com:443>[,serverName=x.org][,fingerprint=safari]"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-mttw <id@domain.com:443:/websocket>[,serverName=x.org][,fingerprint=safari]" >&2 echo "Usage: proxy-msw <id@domain.com:443:/websocket>[,serverName=x.org][,fingerprint=safari]"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-ttpw <password@domain.com:443:/websocket>" >&2 echo "Usage: proxy-tpw <password@domain.com:443:/websocket>"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-ttt <password@domain.com:443>[,serverName=x.org][,fingerprint=safari]" >&2 echo "Usage: proxy-ts <password@domain.com:443>[,serverName=x.org][,fingerprint=safari]"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
usage() { usage() {
>&2 echo "Usage: proxy-tttw <password@domain.com:443:/websocket>[,serverName=x.org][,fingerprint=safari]" >&2 echo "Usage: proxy-tsw <password@domain.com:443:/websocket>[,serverName=x.org][,fingerprint=safari]"
} }
if [ -z "$1" ]; then if [ -z "$1" ]; then

58
run.sh
View File

@@ -6,44 +6,44 @@ XCONF=/tmp/proxy-xray.json
usage() { usage() {
echo "proxy-xray <connection-options>" echo "proxy-xray <connection-options>"
echo " --ltx <VLESS-TCP-XTLS option> id@host:port[,s=sniname.org]" echo " --lx <VLESS-XTLS option> id@host:port[,s=sniname.org]"
echo " --ltt <VLESS-TCP-TLS option> id@host:port[,s=sniname.org]" echo " --ls <VLESS-TLS option> id@host:port[,s=sniname.org]"
echo " --ltpw <VLESS-TCP-PLAIN-WS option> id@host:port:/webpath" echo " --ms <VMESS-TLS option> id@host:port[,s=sniname.org]"
echo " --lttw <VLESS-TCP-TLS-WS option> id@host:port:/webpath[,s=sniname.org]" echo " --ts <TROJAN-TLS option> password@host:port[,s=sniname.org]"
echo " --ltpg <VLESS-TCP-PLAIN-GRPC option> id@host:port:svcname" echo " --lsg <VLESS-TLS-GRPC option> id@host:port:svcname[,s=sniname.org]"
echo " --lttg <VLESS-TCP-TLS-GRPC option> id@host:port:svcname[,s=sniname.org]" echo " --lss <VLESS-TLS-SPLT option> id@host:port:/webpath[,s=sniname.org]"
echo " --mtt <VMESS-TCP-TLS option> id@host:port[,s=sniname.org]" echo " --lsw <VLESS-TLS-WS option> id@host:port:/wspath[,s=sniname.org]"
echo " --mtpw <VMESS-TCP-PLAIN-WS option> id@host:port:/webpath" echo " --msw <VMESS-TLS-WS option> id@host:port:/wspath[,s=sniname.org]"
echo " --mttw <VMESS-TCP-TLS-WS option> id@host:port:/webpath[,s=sniname.org]" echo " --tsw <TROJAN-TLS-WS option> password@host:port:/wspath[,s=sniname.org]"
echo " --ttt <TROJAN-TCP-TLS option> password@host:port[,s=sniname.org]" echo " --lpg <VLESS-PLN-GRPC option> id@host:port:svcname"
echo " --ttpw <TROJAN-TCP-PLAIN-WS option> password@host:port:/webpath" echo " --lps <VLESS-PLN-SPLT option> id@host:port:/webpath"
echo " --tttw <TROJAN-TCP-TLS-WS option> password@host:port:/webpath[,s=sniname.org]" echo " --lpw <VLESS-PLN-WS option> id@host:port:/wspath"
# echo " --ssa <Shadowsocks-AEAD option> password:method@host:port" echo " --mpw <VMESS-PLN-WS option> id@host:port:/wspath"
# echo " --sst <Shadowsocks-TCP option> password:method@host:port" echo " --tpw <TROJAN-PLN-WS option> password@host:port:/wspath"
echo " -d|--debug [Optional] Start in debug mode with verbose output" echo " -d|--debug Start in debug mode with verbose output"
echo " -i|--stdin [Optional] Read config from stdin instead of auto generation" echo " -i|--stdin Read config from stdin instead of auto generation"
echo " --dns <upstream-DNS-ip> [Optional] Designated upstream DNS server IP, 1.1.1.1 will be applied by default" 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> [Optional] Enable designated domain conf file. Like apple.china.conf" # echo " --dns-local <local-conf-file> Enable designated domain conf file. Like apple.china.conf"
echo " --dns-local-cn [Optional] Enable China-accessible domains to be resolved in China" echo " --dns-local-cn Enable China-accessible domains to be resolved in China"
echo " --domain-direct <domain-rule> [Optional] Add a domain rule for direct routing, likegeosite:geosite:geolocation-cn" echo " --domain-direct <domain-rule> Add a domain rule for direct routing, likegeosite:geosite:geolocation-cn"
echo " --domain-proxy <domain-rule> [Optional] Add a domain rule for proxy routing, like twitter.com or geosite:google-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> [Optional] Add a domain rule for block routing, like geosite:category-ads-all" echo " --domain-block <domain-rule> Add a domain rule for block routing, like geosite:category-ads-all"
echo " --ip-direct <ip-rule> [Optional] Add a ip-addr rule for direct routing, like 114.114.114.114/32 or geoip:cn" 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> [Optional] Add a ip-addr rule for proxy routing, like 1.1.1.1/32 or geoip:netflix" 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> [Optional] Add a ip-addr rule for block routing, like geoip:private" echo " --ip-block <ip-rule> Add a ip-addr rule for block routing, like geoip:private"
echo " --cn-direct [Optional] Add routing rules to avoid domains and IPs located in China being proxied" echo " --cn-direct Add routing rules to avoid domains and IPs located in China being proxied"
echo " --rules-path <rules-dir-path> [Optional] Folder path contents geoip.dat, geosite.dat and other rule files" echo " --rules-path <rules-dir-path> Folder path contents geoip.dat, geosite.dat and other rule files"
} }
Jrules='{"rules":[]}' Jrules='{"rules":[]}'
TEMP=`getopt -o di --long ltx:,ltt:,ltpw:,lttw:,ltpg:,lttg:,mtt:,mtpw:,mttw:,ttt:,ttpw:,tttw:,ssa:,sst:,stdin,debug,dns:,dns-local:,dns-local-cn,domain-direct:,domain-proxy:,domain-block:,ip-direct:,ip-proxy:,ip-block:,cn-direct,rules-path: -n "$0" -- $@` TEMP=`getopt -o di --long lx:,ls:,ms:,ts:,lsg:,lss:,lsw:,msw:,tsw:,lpg:,lps:,lpw:,mpw:,tpw:,stdin,debug,dns:,dns-local:,dns-local-cn,domain-direct:,domain-proxy:,domain-block:,ip-direct:,ip-proxy:,ip-block:,cn-direct,rules-path: -n "$0" -- $@`
if [ $? != 0 ] ; then usage; exit 1 ; fi if [ $? != 0 ] ; then usage; exit 1 ; fi
eval set -- "$TEMP" eval set -- "$TEMP"
while true ; do while true ; do
case "$1" in case "$1" in
--ltx|--ltt|--ltpw|--lttw|--ltpg|--lttg|--mtt|--mtpw|--mttw|--ttt|--ttpw|--tttw|--ssa|--sst) --lx|--ls|--ms|--ts|--lsg|--lss|--lsw|--msw|--tsw|--lpg|--lps|--lpw|--mpw|--tpw)
subcmd=`echo "$1"|tr -d "\-\-"` subcmd=`echo "$1"|tr -d "\-\-"`
$DIR/proxy-${subcmd}.sh $2 >$XCONF $DIR/proxy-${subcmd}.sh $2 >$XCONF
if [ $? != 0 ]; then if [ $? != 0 ]; then