mirror of
https://github.com/samuelhbne/proxy-xray.git
synced 2025-12-17 12:44:38 +03:00
sni support
This commit is contained in:
16
README.md
16
README.md
@@ -30,14 +30,14 @@ Please replace "amd64" with the arch match the current box accordingly. Other su
|
||||
```shell
|
||||
$ docker run --rm samuelhbne/proxy-xray
|
||||
proxy-xray <connection-options>
|
||||
--ltx <VLESS-TCP-XTLS option> id@host:port
|
||||
--ltt <VLESS-TCP-TLS option> id@host:port
|
||||
--lttw <VLESS-TCP-TLS-WS option> id@host:port:/webpath
|
||||
--lttg <VLESS-TCP-TLS-GRPC option> id@host:port:/svcpath
|
||||
--mtt <VMESS-TCP-TLS option> id@host:port
|
||||
--mttw <VMESS-TCP-TLS-WS option> id@host:port:/webpath
|
||||
--ttt <TROJAN-TCP-TLS option> password@host:port
|
||||
--tttw <TROJAN-TCP-TLS-WS option> password@host:port:/webpath
|
||||
--ltx <VLESS-TCP-XTLS option> id@host:port[,s=sniname.org]
|
||||
--ltt <VLESS-TCP-TLS option> id@host:port[,s=sniname.org]
|
||||
--lttw <VLESS-TCP-TLS-WS option> id@host:port:/webpath[,s=sniname.org]
|
||||
--lttg <VLESS-TCP-TLS-GRPC option> id@host:port:/svcpath[,s=sniname.org]
|
||||
--mtt <VMESS-TCP-TLS option> id@host:port[,s=sniname.org]
|
||||
--mttw <VMESS-TCP-TLS-WS option> id@host:port:/webpath[,s=sniname.org]
|
||||
--ttt <TROJAN-TCP-TLS option> password@host:port[,s=sniname.org]
|
||||
--tttw <TROJAN-TCP-TLS-WS option> password@host:port:/webpath[,s=sniname.org]
|
||||
-d|--debug [Optional] Start in debug mode with verbose output
|
||||
-i|--stdin [Optional] Read config from stdin instead of auto generation
|
||||
--dns <upstream-DNS-ip> [Optional] Designated upstream DNS server IP, 1.1.1.1 will be applied by default
|
||||
|
||||
31
proxy-ltt.sh
31
proxy-ltt.sh
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "Usage: proxy-ltt <uuid@domain0.com:443>"
|
||||
>&2 echo "Usage: proxy-ltt <id@domain.com:443>[,serverName=x.org][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
@@ -10,15 +10,30 @@ if [ -z "$1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# uuid@domain0.com:443
|
||||
temp=$1
|
||||
options=(`echo $temp |tr '@' ' '`)
|
||||
# id@domain.com:443,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]}"
|
||||
temp="${options[1]}"
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
options=(`echo ${options[1]} |tr ':' ' '`)
|
||||
host="${options[0]}"
|
||||
port="${options[1]}"
|
||||
|
||||
if [ -z "${serverName}" ]; then serverName=${host}; fi
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: uuid undefined."
|
||||
usage
|
||||
@@ -42,8 +57,8 @@ Jusers=`echo '{}' |jq --arg uuid "${id}" '. += {"id":$uuid, "encryption":"none",
|
||||
Jvnext=`echo '{}' | jq --arg host "${host}" --arg port "${port}" --argjson juser "${Jusers}" \
|
||||
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
|
||||
|
||||
JstreamSettings=`echo '{}' | jq --arg host "${host}" \
|
||||
'. += {"network":"tcp", "security":"tls", "tlsSettings":{"serverName":$host}}' `
|
||||
JstreamSettings=`echo '{}' | jq --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" \
|
||||
'. += {"network":"tcp", "security":"tls", "tlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}}' `
|
||||
|
||||
Jproxy=`echo '{}' | jq --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag": "proxy", "protocol":"vless", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "Usage: proxy-lttg <uuid@domain0.com:443:/svcpath>"
|
||||
>&2 echo "Usage: proxy-lttg <id@domain.com:443:/svcpath>[,serverName=x.org][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
@@ -10,16 +10,31 @@ if [ -z "$1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# uuid@domain0.com:443:/svcpath
|
||||
temp=$1
|
||||
options=(`echo $temp |tr '@' ' '`)
|
||||
# id@domain.com:443:/svcpath,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]}"
|
||||
temp="${options[1]}"
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
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
|
||||
@@ -43,8 +58,8 @@ Jusers=`echo '{}' |jq --arg uuid "${id}" '. += {"id":$uuid, "encryption":"none",
|
||||
Jvnext=`echo '{}' | jq --arg host "${host}" --arg port "${port}" --argjson juser "${Jusers}" \
|
||||
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
|
||||
|
||||
JstreamSettings=`echo '{}' | jq --arg host "${host}" --arg path "${path}" \
|
||||
'. += {"network":"grpc", "security":"tls", "tlsSettings":{"serverName":$host}, "grpcSettings":{"serviceName":$path}}' `
|
||||
JstreamSettings=`echo '{}' | jq --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" \
|
||||
'. += {"network":"grpc", "security":"tls", "tlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}, "grpcSettings":{"serviceName":$path}}' `
|
||||
|
||||
Jproxy=`echo '{}' | jq --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag": "proxy", "protocol":"vless", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "Usage: proxy-lttw <uuid@domain0.com:443:/websocket>"
|
||||
>&2 echo "Usage: proxy-lttw <id@domain.com:443:/websocket>[,serverName=x.org][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
@@ -10,16 +10,31 @@ if [ -z "$1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# uuid@domain0.com:443:/websocket
|
||||
temp=$1
|
||||
options=(`echo $temp |tr '@' ' '`)
|
||||
# id@domain.com:443:/websocket,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]}"
|
||||
temp="${options[1]}"
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
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
|
||||
@@ -43,8 +58,8 @@ Jusers=`echo '{}' |jq --arg uuid "${id}" '. += {"id":$uuid, "encryption":"none",
|
||||
Jvnext=`echo '{}' | jq --arg host "${host}" --arg port "${port}" --argjson juser "${Jusers}" \
|
||||
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
|
||||
|
||||
JstreamSettings=`echo '{}' | jq --arg host "${host}" --arg path "${path}" \
|
||||
'. += {"network":"ws", "security":"tls", "tlsSettings":{"serverName":$host}, "wsSettings":{"path":$path}}' `
|
||||
JstreamSettings=`echo '{}' | jq --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" \
|
||||
'. += {"network":"ws", "security":"tls", "tlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}, "wsSettings":{"path":$path}}' `
|
||||
|
||||
Jproxy=`echo '{}' | jq --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag": "proxy", "protocol":"vless", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
|
||||
|
||||
31
proxy-ltx.sh
31
proxy-ltx.sh
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "Usage: proxy-ltx <uuid@domain0.com:443>"
|
||||
>&2 echo "Usage: proxy-ltx <id@domain.com:443>[,serverName=x.org][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
@@ -10,15 +10,30 @@ if [ -z "$1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# uuid@domain0.com:443
|
||||
temp=$1
|
||||
options=(`echo $temp |tr '@' ' '`)
|
||||
# id@domain.com:443,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]}"
|
||||
temp="${options[1]}"
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
options=(`echo ${options[1]} |tr ':' ' '`)
|
||||
host="${options[0]}"
|
||||
port="${options[1]}"
|
||||
|
||||
if [ -z "${serverName}" ]; then serverName=${host}; fi
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: uuid undefined."
|
||||
usage
|
||||
@@ -42,8 +57,8 @@ Jusers=`echo '{}' |jq --arg uuid "${id}" '. += {"id":$uuid, "flow":"xtls-rprx-di
|
||||
Jvnext=`echo '{}' | jq --arg host "${host}" --arg port "${port}" --argjson juser "${Jusers}" \
|
||||
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
|
||||
|
||||
JstreamSettings=`echo '{}' | jq --arg host "${host}" \
|
||||
'. += {"network":"tcp", "security":"xtls", "xtlsSettings":{"serverName":$host}}' `
|
||||
JstreamSettings=`echo '{}' | jq --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" \
|
||||
'. += {"network":"tcp", "security":"xtls", "xtlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}}' `
|
||||
|
||||
Jproxy=`echo '{}' | jq --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag": "proxy", "protocol":"vless", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
|
||||
|
||||
38
proxy-mtt.sh
38
proxy-mtt.sh
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "Usage: proxy-mtt <uuid@domain0.com:443>"
|
||||
>&2 echo "Usage: proxy-mtt <id@domain.com:443>[,serverName=x.org][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
@@ -10,21 +10,29 @@ if [ -z "$1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# password:method@domain0.com:443/websocket
|
||||
temp=$1
|
||||
options=(`echo $temp |tr '@' ' '`)
|
||||
# id@domain.com:443,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]}"
|
||||
temp="${options[1]}"
|
||||
options=(`echo $temp |tr '/' ' '`)
|
||||
path="${options[1]}"
|
||||
temp="${options[0]}"
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
options=(`echo ${options[1]} |tr ':' ' '`)
|
||||
host="${options[0]}"
|
||||
port="${options[1]}"
|
||||
temp=$id
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
passwd="${options[0]}"
|
||||
method="${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."
|
||||
@@ -49,8 +57,8 @@ Jusers=`echo '{}' |jq --arg uuid "${id}" '. += {"id":$uuid, "encryption":"none",
|
||||
Jvnext=`echo '{}' | jq --arg host "${host}" --arg port "${port}" --argjson juser "${Jusers}" \
|
||||
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
|
||||
|
||||
JstreamSettings=`echo '{}' | jq --arg host "${host}" \
|
||||
'. += {"network":"tcp", "security":"tls", "tlsSettings":{"serverName":$host}}' `
|
||||
JstreamSettings=`echo '{}' | jq --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" \
|
||||
'. += {"network":"tcp", "security":"tls", "tlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}}' `
|
||||
|
||||
Jproxy=`echo '{}' | jq --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag": "proxy", "protocol":"vmess", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "Usage: proxy-mttw <uuid@domain0.com:443:/websocket>"
|
||||
>&2 echo "Usage: proxy-mttw <id@domain.com:443:/websocket>[,serverName=x.org][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
@@ -10,16 +10,31 @@ if [ -z "$1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# uuid@domain0.com:443:/websocket
|
||||
temp=$1
|
||||
options=(`echo $temp |tr '@' ' '`)
|
||||
# id@domain.com:443:/websocket,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]}"
|
||||
temp="${options[1]}"
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
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
|
||||
@@ -43,8 +58,8 @@ Jusers=`echo '{}' |jq --arg uuid "${id}" '. += {"id":$uuid, "encryption":"none",
|
||||
Jvnext=`echo '{}' | jq --arg host "${host}" --arg port "${port}" --argjson juser "${Jusers}" \
|
||||
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
|
||||
|
||||
JstreamSettings=`echo '{}' | jq --arg host "${host}" --arg path "${path}" \
|
||||
'. += {"network":"ws", "security":"tls", "tlsSettings":{"serverName":$host}, "wsSettings":{"path":$path}}' `
|
||||
JstreamSettings=`echo '{}' | jq --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" \
|
||||
'. += {"network":"ws", "security":"tls", "tlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}, "wsSettings":{"path":$path}}' `
|
||||
|
||||
Jproxy=`echo '{}' | jq --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag": "proxy", "protocol":"vmess", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
|
||||
|
||||
38
proxy-ttt.sh
38
proxy-ttt.sh
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "Usage: proxy-ttt <uuid@domain0.com:443>"
|
||||
>&2 echo "Usage: proxy-ttt <password@domain.com:443>[,serverName=x.org][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
@@ -10,23 +10,33 @@ if [ -z "$1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# password:method@domain0.com:443:/websocket
|
||||
temp=$1
|
||||
options=(`echo $temp |tr '@' ' '`)
|
||||
# password@domain.com:443,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]}"
|
||||
temp="${options[1]}"
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
options=(`echo ${options[1]} |tr ':' ' '`)
|
||||
host="${options[0]}"
|
||||
port="${options[1]}"
|
||||
path="${options[2]}"
|
||||
passwd="${id}"
|
||||
|
||||
temp=$id
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
passwd="${options[0]}"
|
||||
method="${options[1]}"
|
||||
if [ -z "${serverName}" ]; then serverName=${host}; fi
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${passwd}" ]; then
|
||||
>&2 echo "Error: passwd undefined."
|
||||
>&2 echo "Error: password undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
@@ -46,8 +56,8 @@ if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be
|
||||
Jservers=`echo '{}' | jq --arg host "${host}" --arg port "${port}" --arg passwd "${passwd}" \
|
||||
'. += {"address":$host, "port":($port | tonumber), "password":$passwd}' `
|
||||
|
||||
JstreamSettings=`echo '{}' | jq --arg host "${host}" \
|
||||
'. += {"network":"tcp", "security":"tls", "tlsSettings":{"serverName":$host}}' `
|
||||
JstreamSettings=`echo '{}' | jq --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" \
|
||||
'. += {"network":"tcp", "security":"tls", "tlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}}' `
|
||||
|
||||
Jproxy=`echo '{}' | jq --arg host "${host}" --argjson jservers "${Jservers}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag": "proxy", "protocol":"trojan", "settings":{"servers":[$jservers]}, "streamSettings":$jstreamSettings }' `
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "Usage: proxy-tttw <uuid@domain0.com:443:/websocket>"
|
||||
>&2 echo "Usage: proxy-tttw <password@domain.com:443:/websocket>[,serverName=x.org][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
@@ -10,23 +10,34 @@ if [ -z "$1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# password:method@domain0.com:443:/websocket
|
||||
temp=$1
|
||||
options=(`echo $temp |tr '@' ' '`)
|
||||
# password@domain.com:443:/websocket,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]}"
|
||||
temp="${options[1]}"
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
options=(`echo ${options[1]} |tr ':' ' '`)
|
||||
host="${options[0]}"
|
||||
port="${options[1]}"
|
||||
path="${options[2]}"
|
||||
passwd="${id}"
|
||||
|
||||
temp=$id
|
||||
options=(`echo $temp |tr ':' ' '`)
|
||||
passwd="${options[0]}"
|
||||
method="${options[1]}"
|
||||
if [ -z "${serverName}" ]; then serverName=${host}; fi
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${passwd}" ]; then
|
||||
>&2 echo "Error: passwd undefined."
|
||||
>&2 echo "Error: password undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
@@ -46,8 +57,8 @@ if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be
|
||||
Jservers=`echo '{}' | jq --arg host "${host}" --arg port "${port}" --arg passwd "${passwd}" \
|
||||
'. += {"address":$host, "port":($port | tonumber), "password":$passwd}' `
|
||||
|
||||
JstreamSettings=`echo '{}' | jq --arg host "${host}" --arg path "${path}" \
|
||||
'. += {"network":"ws", "security":"tls", "tlsSettings":{"serverName":$host}, "wsSettings":{"path":$path}}' `
|
||||
JstreamSettings=`echo '{}' | jq --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" \
|
||||
'. += {"network":"ws", "security":"tls", "tlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}, "wsSettings":{"path":$path}}' `
|
||||
|
||||
Jproxy=`echo '{}' | jq --arg host "${host}" --argjson jservers "${Jservers}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag": "proxy", "protocol":"trojan", "settings":{"servers":[$jservers]}, "streamSettings":$jstreamSettings }' `
|
||||
|
||||
16
run.sh
16
run.sh
@@ -6,14 +6,14 @@ XCONF=/tmp/proxy-xray.json
|
||||
|
||||
usage() {
|
||||
echo "proxy-xray <connection-options>"
|
||||
echo " --ltx <VLESS-TCP-XTLS option> id@host:port"
|
||||
echo " --ltt <VLESS-TCP-TLS option> id@host:port"
|
||||
echo " --lttw <VLESS-TCP-TLS-WS option> id@host:port:/webpath"
|
||||
echo " --lttg <VLESS-TCP-TLS-GRPC option> id@host:port:/svcpath"
|
||||
echo " --mtt <VMESS-TCP-TLS option> id@host:port"
|
||||
echo " --mttw <VMESS-TCP-TLS-WS option> id@host:port:/webpath"
|
||||
echo " --ttt <TROJAN-TCP-TLS option> password@host:port"
|
||||
echo " --tttw <TROJAN-TCP-TLS-WS option> password@host:port:/webpath"
|
||||
echo " --ltx <VLESS-TCP-XTLS option> id@host:port[,s=sniname.org]"
|
||||
echo " --ltt <VLESS-TCP-TLS option> id@host:port[,s=sniname.org]"
|
||||
echo " --lttw <VLESS-TCP-TLS-WS option> id@host:port:/webpath[,s=sniname.org]"
|
||||
echo " --lttg <VLESS-TCP-TLS-GRPC option> id@host:port:/svcpath[,s=sniname.org]"
|
||||
echo " --mtt <VMESS-TCP-TLS option> id@host:port[,s=sniname.org]"
|
||||
echo " --mttw <VMESS-TCP-TLS-WS option> id@host:port:/webpath[,s=sniname.org]"
|
||||
echo " --ttt <TROJAN-TCP-TLS option> password@host:port[,s=sniname.org]"
|
||||
echo " --tttw <TROJAN-TCP-TLS-WS option> password@host:port:/webpath[,s=sniname.org]"
|
||||
# echo " --ssa <Shadowsocks-AEAD option> password:method@host:port"
|
||||
# echo " --sst <Shadowsocks-TCP option> password:method@host:port"
|
||||
echo " -d|--debug [Optional] Start in debug mode with verbose output"
|
||||
|
||||
Reference in New Issue
Block a user