mirror of
https://github.com/samuelhbne/proxy-xray.git
synced 2025-12-17 12:44:38 +03:00
Add --lst alpn=h3 support
This commit is contained in:
18
proxy-lgt.sh
18
proxy-lgt.sh
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-GRPC-TLS proxy builder"
|
>&2 echo "VLESS-GRPC-TLS proxy builder"
|
||||||
>&2 echo "Usage: proxy-lgt <id@domain.com:443:/svcpath>[,serverName=x.org][,fingerprint=safari]"
|
>&2 echo "Usage: proxy-lgt <id@domain.com:443:/svcpath>[,serverName=x.org][,fingerprint=safari][,alpn=h3]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
@@ -18,6 +18,9 @@ for ext_opt in "${args[@]}"
|
|||||||
do
|
do
|
||||||
kv=(`echo $ext_opt |tr '=' ' '`)
|
kv=(`echo $ext_opt |tr '=' ' '`)
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
|
a|alpn)
|
||||||
|
ALPN+=("${kv[1]}")
|
||||||
|
;;
|
||||||
s|serverName)
|
s|serverName)
|
||||||
serverName="${kv[1]}"
|
serverName="${kv[1]}"
|
||||||
;;
|
;;
|
||||||
@@ -33,9 +36,6 @@ host="${options[0]}"
|
|||||||
port="${options[1]}"
|
port="${options[1]}"
|
||||||
path="${options[2]}"
|
path="${options[2]}"
|
||||||
|
|
||||||
if [ -z "${serverName}" ]; then serverName=${host}; fi
|
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then
|
||||||
>&2 echo "Error: id undefined."
|
>&2 echo "Error: id undefined."
|
||||||
usage
|
usage
|
||||||
@@ -62,8 +62,14 @@ Jvnext=`jq -nc --arg host "${host}" --arg port "${port}" --argjson juser "${Juse
|
|||||||
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
|
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
|
||||||
|
|
||||||
# Stream Settings
|
# Stream Settings
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" \
|
Jalpn='[]'
|
||||||
'. += {"network":"grpc", "security":"tls", "tlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}, "grpcSettings":{"serviceName":$path}}' `
|
for alpn in "${ALPN[@]}"
|
||||||
|
do
|
||||||
|
Jalpn=`echo $Jalpn | jq -c --arg alpn "${alpn}" '. +=[$alpn]'`
|
||||||
|
done
|
||||||
|
|
||||||
|
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson jalpn "${Jalpn}" \
|
||||||
|
'. += {"network":"grpc","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn},"grpcSettings":{"serviceName":$path}}' `
|
||||||
|
|
||||||
Jproxy=`jq -nc --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
Jproxy=`jq -nc --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||||
'. += { "tag": "proxy", "protocol":"vless", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
|
'. += { "tag": "proxy", "protocol":"vless", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
|
||||||
|
|||||||
21
proxy-lst.sh
21
proxy-lst.sh
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-SPLT-TLS proxy builder"
|
>&2 echo "VLESS-SPLT-TLS proxy builder"
|
||||||
>&2 echo "Usage: proxy-lst <id@domain.com:443:/webpath>[,serverName=x.org][,fingerprint=safari]"
|
>&2 echo "Usage: proxy-lst <id@domain.com:443:/webpath>[,serverName=x.org][,fingerprint=safari][,alpn=h3]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
@@ -18,6 +18,9 @@ for ext_opt in "${args[@]}"
|
|||||||
do
|
do
|
||||||
kv=(`echo $ext_opt |tr '=' ' '`)
|
kv=(`echo $ext_opt |tr '=' ' '`)
|
||||||
case "${kv[0]}" in
|
case "${kv[0]}" in
|
||||||
|
a|alpn)
|
||||||
|
ALPN+=("${kv[1]}")
|
||||||
|
;;
|
||||||
s|serverName)
|
s|serverName)
|
||||||
serverName="${kv[1]}"
|
serverName="${kv[1]}"
|
||||||
;;
|
;;
|
||||||
@@ -33,9 +36,6 @@ host="${options[0]}"
|
|||||||
port="${options[1]}"
|
port="${options[1]}"
|
||||||
path="${options[2]}"
|
path="${options[2]}"
|
||||||
|
|
||||||
if [ -z "${serverName}" ]; then serverName=${host}; fi
|
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then
|
||||||
>&2 echo "Error: id undefined."
|
>&2 echo "Error: id undefined."
|
||||||
usage
|
usage
|
||||||
@@ -54,13 +54,22 @@ fi
|
|||||||
|
|
||||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be numeric"; exit 1; fi
|
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be numeric"; exit 1; fi
|
||||||
|
|
||||||
|
# User settings
|
||||||
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid, "encryption":"none", "level":0}'`
|
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid, "encryption":"none", "level":0}'`
|
||||||
|
|
||||||
|
# Vnest settings
|
||||||
Jvnext=`jq -nc --arg host "${host}" --arg port "${port}" --argjson juser "${Jusers}" \
|
Jvnext=`jq -nc --arg host "${host}" --arg port "${port}" --argjson juser "${Jusers}" \
|
||||||
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
|
'. += {"address":$host, "port":($port | tonumber), "users":[$juser]}' `
|
||||||
|
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" \
|
# Stream Settings
|
||||||
'. += {"network":"splithttp", "security":"tls", "tlsSettings":{"serverName":$serverName, "fingerprint":$fingerprint}, "splithttpSettings":{"path":$path}}' `
|
Jalpn='[]'
|
||||||
|
for alpn in "${ALPN[@]}"
|
||||||
|
do
|
||||||
|
Jalpn=`echo $Jalpn | jq -c --arg alpn "${alpn}" '. +=[$alpn]'`
|
||||||
|
done
|
||||||
|
|
||||||
|
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson jalpn "${Jalpn}" \
|
||||||
|
'. += {"network":"splithttp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn},"splithttpSettings":{"path":$path}}' `
|
||||||
|
|
||||||
Jproxy=`jq -nc --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
Jproxy=`jq -nc --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||||
'. += { "tag": "proxy", "protocol":"vless", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
|
'. += { "tag": "proxy", "protocol":"vless", "settings":{"vnext":[$jvnext]}, "streamSettings":$jstreamSettings }' `
|
||||||
|
|||||||
4
run.sh
4
run.sh
@@ -10,7 +10,7 @@ usage() {
|
|||||||
echo " --lgr <VLESS-GRPC-RLTY option> id@host:port:svcname,d=dest.com,pub=xxxx[,shortId=abcd]"
|
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 " --lgt <VLESS-GRPC-TLS option> id@host:port:svcname[,s=sni.com]"
|
||||||
echo " --lsp <VLESS-SPLT-PLN option> id@host:port:/webpath"
|
echo " --lsp <VLESS-SPLT-PLN option> id@host:port:/webpath"
|
||||||
echo " --lst <VLESS-SPLT-TLS option> id@host:port:/webpath[,s=sni.com]"
|
echo " --lst <VLESS-SPLT-TLS option> id@host:port:/webpath[,s=sni.com][,alpn=h3]"
|
||||||
echo " --ltr <VLESS-TCP-RLTY option> id@host:port,d=dest.com,pub=xxxx[,shortId=abcd][,xtls]"
|
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 " --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 " --ltt <VLESS-TCP-TLS option> id@host:port[,s=sni.com][,xtls]"
|
||||||
@@ -58,8 +58,8 @@ while true ; do
|
|||||||
fi
|
fi
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
# Alias options
|
|
||||||
--ltrx|--lttx)
|
--ltrx|--lttx)
|
||||||
|
# Alias options
|
||||||
subcmd=`echo $1|tr -d '\-\-'|tr -d x`
|
subcmd=`echo $1|tr -d '\-\-'|tr -d x`
|
||||||
$DIR/proxy-${subcmd}.sh $2,xtls >$XCONF
|
$DIR/proxy-${subcmd}.sh $2,xtls >$XCONF
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user