mirror of
https://github.com/samuelhbne/proxy-xray.git
synced 2025-12-16 12:17:06 +03:00
Rewrite with json stdout
This commit is contained in:
36
proxy-lgp.sh
36
proxy-lgp.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VLESS-GRPC-PLAIN proxy builder"
|
||||
>&2 echo "Usage: proxy-lgp <id@domain.com:80:svcname>"
|
||||
>&2 echo -e "VLESS-GRPC-PLAIN proxy builder"
|
||||
>&2 echo -e "Usage: proxy-lgp <id@domain.com:80:svcname>"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:80:/svcpath
|
||||
@@ -19,30 +18,20 @@ host="${options[0]}"
|
||||
port="${options[1]}"
|
||||
path="${options[2]}"
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=80
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
JstreamSettings=`jq -nc --arg path "${path}" \
|
||||
@@ -50,11 +39,6 @@ JstreamSettings=`jq -nc --arg path "${path}" \
|
||||
|
||||
Jproxy=`jq -nc --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=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
42
proxy-lgr.sh
42
proxy-lgr.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VLESS-GRPC-TLS proxy builder"
|
||||
>&2 echo "Usage: proxy-lgr <id@domain.com:443:svcname><d=yahoo.com>,pub=xxxx[,shortId=abcd][,fingerprint=safari]"
|
||||
>&2 echo -e "VLESS-GRPC-TLS proxy builder"
|
||||
>&2 echo -e "Usage: proxy-lgr <id@domain.com:443:svcname><d=yahoo.com>,pub=xxxx[,shortId=abcd][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443:/svcpath,dest=yahoo.com,pub=xxxx,fingerprint=safari
|
||||
@@ -50,36 +49,22 @@ path="${options[2]}"
|
||||
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
fi
|
||||
if [ -z "${publicKey}" ]; then >&2 echo -e "Error: publicKey undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${publicKey}" ]; then
|
||||
>&2 echo "Error: publicKey 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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" --arg flow "${flow}" '. += {"flow":$flow,"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg publicKey "${publicKey}" --arg shortId "${shortId}" --arg fingerprint "${fingerprint}" --arg path "${path}" \
|
||||
@@ -87,11 +72,6 @@ JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg publicKey "${publ
|
||||
|
||||
Jproxy=`jq -nc --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=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
40
proxy-lgt.sh
40
proxy-lgt.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VLESS-GRPC-TLS proxy builder"
|
||||
>&2 echo "Usage: proxy-lgt <id@domain.com:443:svcname>[,fingerprint=safari][,alpn=h3]"
|
||||
>&2 echo -e "VLESS-GRPC-TLS proxy builder"
|
||||
>&2 echo -e "Usage: proxy-lgt <id@domain.com:443:svcname>[,fingerprint=safari][,alpn=h3]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443:/svcpath,fingerprint=safari
|
||||
@@ -38,43 +37,28 @@ path="${options[2]}"
|
||||
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||
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}}' `
|
||||
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}" \
|
||||
'. += { "tag":"proxy","protocol":"vless","settings":{"vnext":[$jvnext]},"streamSettings":$jstreamSettings}' `
|
||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
||||
|
||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
39
proxy-lsp.sh
39
proxy-lsp.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VLESS-SPLT-PLAIN proxy builder"
|
||||
>&2 echo "Usage: proxy-lsp <id@domain.com:80:/webpath>"
|
||||
>&2 echo -e "VLESS-SPLT-PLAIN proxy builder"
|
||||
>&2 echo -e "Usage: proxy-lsp <id@domain.com:80:/webpath>"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443:/webpath
|
||||
@@ -19,39 +18,27 @@ host="${options[0]}"
|
||||
port="${options[1]}"
|
||||
path="${options[2]}"
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=80
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
JstreamSettings=`jq -nc --arg path "${path}" \
|
||||
'. += {"network":"splithttp","security":"none","splithttpSettings":{"path":$path}}' `
|
||||
|
||||
Jproxy=`jq -nc --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=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
40
proxy-lst.sh
40
proxy-lst.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VLESS-SPLT-TLS proxy builder"
|
||||
>&2 echo "Usage: proxy-lst <id@domain.com:443:/webpath>[,fingerprint=safari][,alpn=h3]"
|
||||
>&2 echo -e "VLESS-SPLT-TLS proxy builder"
|
||||
>&2 echo -e "Usage: proxy-lst <id@domain.com:443:/webpath>[,fingerprint=safari][,alpn=h3]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443:/webpath,fingerprint=safari
|
||||
@@ -38,43 +37,28 @@ path="${options[2]}"
|
||||
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||
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}}' `
|
||||
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}" \
|
||||
'. += { "tag":"proxy","protocol":"vless","settings":{"vnext":[$jvnext]},"streamSettings":$jstreamSettings}' `
|
||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
||||
|
||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
42
proxy-ltr.sh
42
proxy-ltr.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VLESS-TCP-REALITY proxy builder"
|
||||
>&2 echo "Usage: proxy-ltr <id@domain.com:443>,<d=yahoo.com>,pub=xxxx[,shortId=abcd][,xtls][,fingerprint=safari]"
|
||||
>&2 echo -e "VLESS-TCP-REALITY proxy builder"
|
||||
>&2 echo -e "Usage: proxy-ltr <id@domain.com:443>,<d=yahoo.com>,pub=xxxx[,shortId=abcd][,xtls][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443,dest=yaho.com,fingerprint=safari
|
||||
@@ -49,36 +48,22 @@ port="${options[1]}"
|
||||
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
fi
|
||||
if [ -z "${publicKey}" ]; then >&2 echo -e "Error: publicKey undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${publicKey}" ]; then
|
||||
>&2 echo "Error: publicKey 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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" --arg flow "${flow}" '. += {"flow":$flow,"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg publicKey "${publicKey}" --arg shortId "${shortId}" --arg fingerprint "${fingerprint}" \
|
||||
@@ -86,11 +71,6 @@ JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg publicKey "${publ
|
||||
|
||||
Jproxy=`jq -nc --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=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
40
proxy-ltt.sh
40
proxy-ltt.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VLESS-TCP-TLS proxy builder"
|
||||
>&2 echo "Usage: proxy-ltt <id@domain.com:443>[,xtls][,fingerprint=safari]"
|
||||
>&2 echo -e "VLESS-TCP-TLS proxy builder"
|
||||
>&2 echo -e "Usage: proxy-ltt <id@domain.com:443>[,xtls][,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443,fingerprint=safari
|
||||
@@ -40,43 +39,28 @@ port="${options[1]}"
|
||||
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" --arg flow "${flow}" '. += {"flow":$flow,"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" \
|
||||
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn}}' `
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --argjson Jalpn "${Jalpn}" \
|
||||
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$Jalpn}}' `
|
||||
|
||||
Jproxy=`jq -nc --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=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
39
proxy-lwp.sh
39
proxy-lwp.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VLESS-WS-PLAIN proxy builder"
|
||||
>&2 echo "Usage: proxy-lwp <id@domain.com:80:/websocket>"
|
||||
>&2 echo -e "VLESS-WS-PLAIN proxy builder"
|
||||
>&2 echo -e "Usage: proxy-lwp <id@domain.com:80:/websocket>"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443:/websocket
|
||||
@@ -19,39 +18,27 @@ host="${options[0]}"
|
||||
port="${options[1]}"
|
||||
path="${options[2]}"
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=80
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
JstreamSettings=`jq -nc --arg path "${path}" \
|
||||
'. += {"network":"ws","security":"none","wsSettings":{"path":$path}}' `
|
||||
|
||||
Jproxy=`jq -nc --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=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
40
proxy-lwt.sh
40
proxy-lwt.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VLESS-WS-TLS proxy builder"
|
||||
>&2 echo "Usage: proxy-lwt <id@domain.com:443:/websocket>[,fingerprint=safari]"
|
||||
>&2 echo -e "VLESS-WS-TLS proxy builder"
|
||||
>&2 echo -e "Usage: proxy-lwt <id@domain.com:443:/websocket>[,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443:/websocket,fingerprint=safari
|
||||
@@ -38,43 +37,28 @@ path="${options[2]}"
|
||||
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson jalpn "${Jalpn}" \
|
||||
'. += {"network":"ws","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn},"wsSettings":{"path":$path}}' `
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson Jalpn "${Jalpn}" \
|
||||
'. += {"network":"ws","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$Jalpn},"wsSettings":{"path":$path}}' `
|
||||
|
||||
Jproxy=`jq -nc --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=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
40
proxy-mtt.sh
40
proxy-mtt.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VMESS-TCP-TLS proxy builder"
|
||||
>&2 echo "Usage: proxy-mtt <id@domain.com:443>[,fingerprint=safari]"
|
||||
>&2 echo -e "VMESS-TCP-TLS proxy builder"
|
||||
>&2 echo -e "Usage: proxy-mtt <id@domain.com:443>[,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443,fingerprint=safari
|
||||
@@ -37,43 +36,28 @@ port="${options[1]}"
|
||||
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --argjson jalpn "${Jalpn}" \
|
||||
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn}}' `
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --argjson Jalpn "${Jalpn}" \
|
||||
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$Jalpn}}' `
|
||||
|
||||
Jproxy=`jq -nc --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag":"proxy","protocol":"vmess","settings":{"vnext":[$jvnext]},"streamSettings":$jstreamSettings}' `
|
||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
||||
|
||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
44
proxy-mwp.sh
44
proxy-mwp.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VMESS-WS-PLAIN proxy builder"
|
||||
>&2 echo "Usage: proxy-mwp <id@domain.com:443:/websocket>"
|
||||
>&2 echo -e "VMESS-WS-PLAIN proxy builder"
|
||||
>&2 echo -e "Usage: proxy-mwp <id@domain.com:443:/websocket>"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443:/websocket
|
||||
@@ -19,42 +18,27 @@ 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 -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; 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 [ -z "${port}" ]; then
|
||||
port=443
|
||||
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 -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
JstreamSettings=`jq -nc --arg path "${path}" \
|
||||
'. += {"network":"ws","security":"none","wsSettings":{"path":$path}}' `
|
||||
|
||||
Jproxy=`jq -nc --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag": proxy","protocol":"vmess","settings":{"vnext":[$jvnext]},"streamSettings":$jstreamSettings}' `
|
||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
||||
'. += { "tag":"proxy","protocol":"vmess","settings":{"vnext":[$jvnext]},"streamSettings":$jstreamSettings}' `
|
||||
|
||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
42
proxy-mwt.sh
42
proxy-mwt.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "VMESS-WS-TLS proxy builder"
|
||||
>&2 echo "Usage: proxy-mwt <id@domain.com:443:/websocket>[,fingerprint=safari]"
|
||||
>&2 echo -e "VMESS-WS-TLS proxy builder"
|
||||
>&2 echo -e "Usage: proxy-mwt <id@domain.com:443:/websocket>[,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# id@domain.com:443:/websocket,fingerprint=safari
|
||||
@@ -38,43 +37,28 @@ path="${options[2]}"
|
||||
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${id}" ]; then
|
||||
>&2 echo "Error: id undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jusers=`jq -nc --arg uuid "${id}" '. += {"id":$uuid,"encryption":"none","level":0}'`
|
||||
|
||||
# Vnext settings
|
||||
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]}' `
|
||||
|
||||
# Stream Settings
|
||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson jalpn "${Jalpn}" \
|
||||
'. += {"network":"ws","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn},"wsSettings":{"path":$path}}' `
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson Jalpn "${Jalpn}" \
|
||||
'. += {"network":"ws","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$Jalpn},"wsSettings":{"path":$path}}' `
|
||||
|
||||
Jproxy=`jq -nc --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag":"proxy","protocol":"vmess","settings":{"vnext":[$jvnext]},"streamSettings":$jstreamSettings }' `
|
||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
||||
'. += { "tag":"proxy","protocol":"vmess","settings":{"vnext":[$jvnext]},"streamSettings":$jstreamSettings}' `
|
||||
|
||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
42
proxy-ttt.sh
42
proxy-ttt.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "TROJAN-TCP-TLS proxy builder"
|
||||
>&2 echo "Usage: proxy-ttt <password@domain.com:443>[,fingerprint=safari]"
|
||||
>&2 echo -e "TROJAN-TCP-TLS proxy builder"
|
||||
>&2 echo -e "Usage: proxy-ttt <password@domain.com:443>[,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# password@domain.com:443,fingerprint=safari
|
||||
@@ -38,40 +37,25 @@ passwd="${id}"
|
||||
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${passwd}" ]; then
|
||||
>&2 echo "Error: password undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${passwd}" ]; then >&2 echo -e "Error: password undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jservers=`jq -nc --arg host "${host}" --arg port "${port}" --arg passwd "${passwd}" \
|
||||
'. += {"address":$host,"port":($port | tonumber),"password":$passwd}' `
|
||||
'. += {"address":$host,"port":($port|tonumber),"password":$passwd}' `
|
||||
|
||||
# Stream Settings
|
||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --argjson jalpn "${Jalpn}" \
|
||||
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn}}' `
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --argjson Jalpn "${Jalpn}" \
|
||||
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$Jalpn}}' `
|
||||
|
||||
Jproxy=`jq -nc --arg host "${host}" --argjson jservers "${Jservers}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag":"proxy","protocol":"trojan","settings":{"servers":[$jservers]},"streamSettings":$jstreamSettings }' `
|
||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
||||
'. += { "tag":"proxy","protocol":"trojan","settings":{"servers":[$jservers]},"streamSettings":$jstreamSettings}' `
|
||||
|
||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
36
proxy-twp.sh
36
proxy-twp.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "TROJAN-WS-PLAIN proxy builder"
|
||||
>&2 echo "Usage: proxy-twp <password@domain.com:443:/websocket>"
|
||||
>&2 echo -e "TROJAN-WS-PLAIN proxy builder"
|
||||
>&2 echo -e "Usage: proxy-twp <password@domain.com:443:/websocket>"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# password@domain.com:443:/websocket
|
||||
@@ -20,27 +19,17 @@ port="${options[1]}"
|
||||
path="${options[2]}"
|
||||
passwd="${id}"
|
||||
|
||||
if [ -z "${passwd}" ]; then
|
||||
>&2 echo "Error: password undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${passwd}" ]; then >&2 echo -e "Error: password undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jservers=`jq -nc --arg host "${host}" --arg port "${port}" --arg passwd "${passwd}" \
|
||||
'. += {"address":$host,"port":($port | tonumber),"password":$passwd}' `
|
||||
'. += {"address":$host,"port":($port|tonumber),"password":$passwd}' `
|
||||
|
||||
# Stream Settings
|
||||
JstreamSettings=`jq -nc --arg path "${path}" \
|
||||
@@ -48,11 +37,6 @@ JstreamSettings=`jq -nc --arg path "${path}" \
|
||||
|
||||
Jproxy=`jq -nc --arg host "${host}" --argjson jservers "${Jservers}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag":"proxy","protocol":"trojan","settings":{"servers":[$jservers]},"streamSettings":$jstreamSettings}' `
|
||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
||||
|
||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
42
proxy-twt.sh
42
proxy-twt.sh
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
usage() {
|
||||
>&2 echo "TROJAN-WS-TLS proxy builder"
|
||||
>&2 echo "Usage: proxy-twt <password@domain.com:443:/websocket>[,fingerprint=safari]"
|
||||
>&2 echo -e "TROJAN-WS-TLS proxy builder"
|
||||
>&2 echo -e "Usage: proxy-twt <password@domain.com:443:/websocket>[,fingerprint=safari]"
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
>&2 echo "Missing options"
|
||||
usage
|
||||
exit 1
|
||||
>&2 echo -e "Missing command options.\n"
|
||||
usage; exit 1
|
||||
fi
|
||||
|
||||
# password@domain.com:443:/websocket,fingerprint=safari
|
||||
@@ -39,40 +38,25 @@ passwd="${id}"
|
||||
|
||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||
|
||||
if [ -z "${passwd}" ]; then
|
||||
>&2 echo "Error: password undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${passwd}" ]; then >&2 echo -e "Error: password undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${host}" ]; then
|
||||
>&2 echo "Error: destination host undefined."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||
|
||||
if [ -z "${port}" ]; then
|
||||
port=443
|
||||
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
|
||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||
|
||||
# User settings
|
||||
Jservers=`jq -nc --arg host "${host}" --arg port "${port}" --arg passwd "${passwd}" \
|
||||
'. += {"address":$host,"port":($port | tonumber),"password":$passwd}' `
|
||||
'. += {"address":$host,"port":($port|tonumber),"password":$passwd}' `
|
||||
|
||||
# Stream Settings
|
||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson jalpn "${Jalpn}" \
|
||||
'. += {"network":"ws","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn},"wsSettings":{"path":$path}}' `
|
||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson Jalpn "${Jalpn}" \
|
||||
'. += {"network":"ws","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$Jalpn},"wsSettings":{"path":$path}}' `
|
||||
|
||||
Jproxy=`jq -nc --arg host "${host}" --argjson jservers "${Jservers}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||
'. += { "tag":"proxy","protocol":"trojan","settings":{"servers":[$jservers]},"streamSettings":$jstreamSettings }' `
|
||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
||||
'. += { "tag":"proxy","protocol":"trojan","settings":{"servers":[$jservers]},"streamSettings":$jstreamSettings}' `
|
||||
|
||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
||||
|
||||
echo "$jroot"
|
||||
echo "$Jproxy"
|
||||
exit 0
|
||||
|
||||
111
run.sh
111
run.sh
@@ -26,7 +26,7 @@ usage() {
|
||||
echo " --twt <TROJAN-WS-TLS option> 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"}'"
|
||||
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"
|
||||
@@ -50,39 +50,20 @@ while true ; do
|
||||
case "$1" in
|
||||
--lgp|--lgr|--lgt|--lsp|--lst|--ltr|--ltt|--lwp|--lwt|--mtt|--mwp|--mwt|--ttt|--twp|--twt)
|
||||
subcmd=`echo "$1"|tr -d "\-\-"`
|
||||
$DIR/proxy-${subcmd}.sh $2 >$XCONF
|
||||
if [ $? != 0 ]; then
|
||||
echo "${subcmd} Config failed: $DIR/proxy-${subcmd}.sh $2"
|
||||
exit 2
|
||||
else
|
||||
XRAYCFG=1
|
||||
fi
|
||||
PXCMD="$DIR/proxy-${subcmd}.sh $2"
|
||||
shift 2
|
||||
;;
|
||||
--ltrx|--lttx)
|
||||
# Alias of --ltr|ltt options
|
||||
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
|
||||
PXCMD="$DIR/proxy-${subcmd}.sh $2,xtls"
|
||||
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
|
||||
PXCMD="$DIR/proxy-${subcmd}.sh $2,alpn=h3"
|
||||
shift 2
|
||||
;;
|
||||
--dns)
|
||||
@@ -152,8 +133,7 @@ while true ; do
|
||||
shift 2
|
||||
;;
|
||||
-i|--stdin)
|
||||
STDINCONF=1
|
||||
XRAYCFG=1
|
||||
exec /usr/local/bin/xray
|
||||
shift 1
|
||||
;;
|
||||
-d|--debug)
|
||||
@@ -171,10 +151,42 @@ while true ; do
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "${XRAYCFG}" != "1" ]; then
|
||||
echo "Missing Xray connection option"
|
||||
usage
|
||||
exit 1
|
||||
if [ -z "${PXCMD}" ]; then >&2 echo -e "Missing Xray connection option.\n"; usage; exit 1; fi
|
||||
|
||||
# Init root config
|
||||
Jroot='{"outbounds":[{"tag":"direct","protocol":"freedom"},{"tag":"blocked","protocol":"blackhole"}]}'
|
||||
|
||||
# Add outbounds config
|
||||
Joutbound=`$PXCMD`
|
||||
if [ $? != 0 ]; then >&2 echo -e "${subcmd} Config failed: $PXCMD\n"; exit 2; fi
|
||||
Jroot=`echo $Jroot|jq --argjson Joutbound "${Joutbound}" '.outbounds += [$Joutbound]'`
|
||||
|
||||
# Add inbounds config
|
||||
if [ -z "${DNS}" ]; then DNS="1.1.1.1"; fi
|
||||
JibDNS=`jq -nc --arg dns "${DNS}" \
|
||||
'. +={"tag":"dns-in","port":5353,"listen":"0.0.0.0","protocol":"dokodemo-door","settings":{"address":$dns,"port":53,"network":"tcp,udp"}}'`
|
||||
JibSOCKS=`jq -nc '. +={"tag":"socks","port":1080,"listen":"0.0.0.0","protocol":"socks","settings":{"udp":true}}'`
|
||||
JibHTTP=`jq -nc '. +={"tag":"http","port":8123,"listen":"0.0.0.0","protocol":"http"}'`
|
||||
Jroot=`echo $Jroot|jq --argjson JibDNS "${JibDNS}" --argjson JibSOCKS "${JibSOCKS}" --argjson JibHTTP "${JibHTTP}" \
|
||||
'.inbounds += [$JibDNS,$JibSOCKS,$JibHTTP]'`
|
||||
|
||||
# Add routing config
|
||||
Jrouting='{"routing":{"domainStrategy":"AsIs"}}'
|
||||
Jrouting=`echo "${Jrouting}" |jq --argjson jrules "${Jrules}" '.routing += $jrules'`
|
||||
Jroot=`echo $Jroot|jq --argjson Jrouting "${Jrouting}" '.routing += $Jrouting'`
|
||||
|
||||
# Add debug config
|
||||
if [ -n "${DEBUG}" ]; then loglevel="debug"; else loglevel="warning"; fi
|
||||
Jroot=`echo $Jroot| jq --arg loglevel "${loglevel}" '.log.loglevel |= $loglevel'`
|
||||
|
||||
# Merge injected json config
|
||||
if [ -n "${INJECT}" ]; then
|
||||
for JSON_IN in "${INJECT[@]}"
|
||||
do
|
||||
Jmerge=`jq -nc "${JSON_IN}"`
|
||||
if [[ $? -ne 0 ]]; then echo "Invalid json ${JSON_IN}"; exit 1; fi
|
||||
Jroot=`jq -n --argjson Jroot "${Jroot}" --argjson Jmerge "${Jmerge}" '$Jroot + $Jmerge'`
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "${DNSLOCAL}" ]; then
|
||||
@@ -186,43 +198,6 @@ fi
|
||||
echo -e "no-resolv\nserver=127.0.0.1#5353" >/etc/dnsmasq.d/upstream.conf
|
||||
/usr/sbin/dnsmasq
|
||||
|
||||
if [ -z "${DNS}" ]; then
|
||||
DNS="1.1.1.1"
|
||||
fi
|
||||
|
||||
# Add inbounds config
|
||||
JibDKDEMO=`jq -nc --arg dns "${DNS}" \
|
||||
'. +={"tag":"dns-in","port":5353,"listen":"0.0.0.0","protocol":"dokodemo-door","settings":{"address":$dns,"port":53,"network":"tcp,udp"}}' `
|
||||
JibSOCKS=`jq -nc '. +={"tag":"socks","port":1080,"listen":"0.0.0.0","protocol":"socks","settings":{"udp":true}}' `
|
||||
JibHTTP=`jq -nc '. +={"tag":"http","port":8123,"listen":"0.0.0.0","protocol":"http"}' `
|
||||
cat $XCONF| jq --argjson jibdkdemo "${JibDKDEMO}" --argjson jibsocks "${JibSOCKS}" --argjson jibhttp "${JibHTTP}" \
|
||||
'. += {"inbounds":[$jibdkdemo, $jibsocks, $jibhttp]}' | sponge $XCONF
|
||||
|
||||
# Add routing config
|
||||
Jrouting='{"routing":{"domainStrategy":"AsIs"}}'
|
||||
Jrouting=`echo "${Jrouting}" |jq --argjson jrules "${Jrules}" '.routing += $jrules'`
|
||||
cat $XCONF| jq --argjson jrouting "${Jrouting}" '. += $jrouting' | sponge $XCONF
|
||||
|
||||
if [ "${STDINCONF}" = "1" ]; then
|
||||
exec /usr/local/bin/xray
|
||||
fi
|
||||
|
||||
if [ "${DEBUG}" = "1" ]; then
|
||||
cat $XCONF |jq '.log.loglevel |="debug"' | sponge $XCONF
|
||||
cat $XCONF
|
||||
fi
|
||||
|
||||
if [ -n "${INJECT}" ]; then
|
||||
for JSON_IN in "${INJECT[@]}"
|
||||
do
|
||||
echo "${JSON_IN}"|jq -ec >/tmp/merge.json
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "Invalid json ${JSON_IN}"
|
||||
exit 1
|
||||
fi
|
||||
jq -s '.[0] * .[1]' $XCONF /tmp/merge.json |sponge $XCONF
|
||||
done
|
||||
fi
|
||||
|
||||
jq -n "$Jroot"
|
||||
jq -n "$Jroot">$XCONF
|
||||
exec /usr/local/bin/xray -c $XCONF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user