mirror of
https://github.com/samuelhbne/proxy-xray.git
synced 2025-12-16 20:27: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
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-GRPC-PLAIN proxy builder"
|
>&2 echo -e "VLESS-GRPC-PLAIN proxy builder"
|
||||||
>&2 echo "Usage: proxy-lgp <id@domain.com:80:svcname>"
|
>&2 echo -e "Usage: proxy-lgp <id@domain.com:80:svcname>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:80:/svcpath
|
# id@domain.com:80:/svcpath
|
||||||
@@ -19,30 +18,20 @@ host="${options[0]}"
|
|||||||
port="${options[1]}"
|
port="${options[1]}"
|
||||||
path="${options[2]}"
|
path="${options[2]}"
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=80; fi
|
||||||
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
|
# 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}'`
|
||||||
|
|
||||||
# Vnext settings
|
# Vnext 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]}' `
|
||||||
|
|
||||||
# Stream Settings
|
# Stream Settings
|
||||||
JstreamSettings=`jq -nc --arg path "${path}" \
|
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}" \
|
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}' `
|
||||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
|
||||||
Jblocked='{"tag": "blocked","protocol":"blackhole","settings":{}}'
|
|
||||||
|
|
||||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
42
proxy-lgr.sh
42
proxy-lgr.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-GRPC-TLS proxy builder"
|
>&2 echo -e "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 "Usage: proxy-lgr <id@domain.com:443:svcname><d=yahoo.com>,pub=xxxx[,shortId=abcd][,fingerprint=safari]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443:/svcpath,dest=yahoo.com,pub=xxxx,fingerprint=safari
|
# 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 "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${publicKey}" ]; then >&2 echo -e "Error: publicKey undefined.\n"; usage; exit 1; fi
|
||||||
port=443
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${publicKey}" ]; then
|
if [ -z "${port}" ]; then port=443; fi
|
||||||
>&2 echo "Error: publicKey undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be numeric"; exit 1; fi
|
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||||
|
|
||||||
# User settings
|
# User settings
|
||||||
Jusers=`jq -nc --arg uuid "${id}" --arg flow "${flow}" '. += {"flow":$flow,"id":$uuid,"encryption":"none","level":0}'`
|
Jusers=`jq -nc --arg uuid "${id}" --arg flow "${flow}" '. += {"flow":$flow,"id":$uuid,"encryption":"none","level":0}'`
|
||||||
|
|
||||||
# Vnext settings
|
# Vnext 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]}' `
|
||||||
|
|
||||||
# Stream Settings
|
# Stream Settings
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg publicKey "${publicKey}" --arg shortId "${shortId}" --arg fingerprint "${fingerprint}" --arg path "${path}" \
|
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}" \
|
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}' `
|
||||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
|
||||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
|
||||||
|
|
||||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
40
proxy-lgt.sh
40
proxy-lgt.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-GRPC-TLS proxy builder"
|
>&2 echo -e "VLESS-GRPC-TLS proxy builder"
|
||||||
>&2 echo "Usage: proxy-lgt <id@domain.com:443:svcname>[,fingerprint=safari][,alpn=h3]"
|
>&2 echo -e "Usage: proxy-lgt <id@domain.com:443:svcname>[,fingerprint=safari][,alpn=h3]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443:/svcpath,fingerprint=safari
|
# id@domain.com:443:/svcpath,fingerprint=safari
|
||||||
@@ -38,43 +37,28 @@ path="${options[2]}"
|
|||||||
|
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=443; fi
|
||||||
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
|
# 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}'`
|
||||||
|
|
||||||
# Vnext settings
|
# Vnext 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]}' `
|
||||||
|
|
||||||
# Stream Settings
|
# Stream Settings
|
||||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson jalpn "${Jalpn}" \
|
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}}' `
|
'. += {"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}' `
|
||||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
|
||||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
|
||||||
|
|
||||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
39
proxy-lsp.sh
39
proxy-lsp.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-SPLT-PLAIN proxy builder"
|
>&2 echo -e "VLESS-SPLT-PLAIN proxy builder"
|
||||||
>&2 echo "Usage: proxy-lsp <id@domain.com:80:/webpath>"
|
>&2 echo -e "Usage: proxy-lsp <id@domain.com:80:/webpath>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443:/webpath
|
# id@domain.com:443:/webpath
|
||||||
@@ -19,39 +18,27 @@ host="${options[0]}"
|
|||||||
port="${options[1]}"
|
port="${options[1]}"
|
||||||
path="${options[2]}"
|
path="${options[2]}"
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=80; fi
|
||||||
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}'`
|
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}" \
|
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}" \
|
JstreamSettings=`jq -nc --arg path "${path}" \
|
||||||
'. += {"network":"splithttp","security":"none","splithttpSettings":{"path":$path}}' `
|
'. += {"network":"splithttp","security":"none","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}' `
|
||||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
|
||||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
|
||||||
|
|
||||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
40
proxy-lst.sh
40
proxy-lst.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-SPLT-TLS proxy builder"
|
>&2 echo -e "VLESS-SPLT-TLS proxy builder"
|
||||||
>&2 echo "Usage: proxy-lst <id@domain.com:443:/webpath>[,fingerprint=safari][,alpn=h3]"
|
>&2 echo -e "Usage: proxy-lst <id@domain.com:443:/webpath>[,fingerprint=safari][,alpn=h3]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443:/webpath,fingerprint=safari
|
# id@domain.com:443:/webpath,fingerprint=safari
|
||||||
@@ -38,43 +37,28 @@ path="${options[2]}"
|
|||||||
|
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=443; fi
|
||||||
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
|
# 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}'`
|
||||||
|
|
||||||
# Vnext settings
|
# Vnext 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]}' `
|
||||||
|
|
||||||
# Stream Settings
|
# Stream Settings
|
||||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson jalpn "${Jalpn}" \
|
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}}' `
|
'. += {"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}' `
|
||||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
|
||||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
|
||||||
|
|
||||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
42
proxy-ltr.sh
42
proxy-ltr.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-TCP-REALITY proxy builder"
|
>&2 echo -e "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 "Usage: proxy-ltr <id@domain.com:443>,<d=yahoo.com>,pub=xxxx[,shortId=abcd][,xtls][,fingerprint=safari]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443,dest=yaho.com,fingerprint=safari
|
# 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 "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${publicKey}" ]; then >&2 echo -e "Error: publicKey undefined.\n"; usage; exit 1; fi
|
||||||
port=443
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${publicKey}" ]; then
|
if [ -z "${port}" ]; then port=443; fi
|
||||||
>&2 echo "Error: publicKey undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo "Port number must be numeric"; exit 1; fi
|
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||||
|
|
||||||
# User settings
|
# User settings
|
||||||
Jusers=`jq -nc --arg uuid "${id}" --arg flow "${flow}" '. += {"flow":$flow,"id":$uuid,"encryption":"none","level":0}'`
|
Jusers=`jq -nc --arg uuid "${id}" --arg flow "${flow}" '. += {"flow":$flow,"id":$uuid,"encryption":"none","level":0}'`
|
||||||
|
|
||||||
# Vnext settings
|
# Vnext 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]}' `
|
||||||
|
|
||||||
# Stream Settings
|
# Stream Settings
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg publicKey "${publicKey}" --arg shortId "${shortId}" --arg fingerprint "${fingerprint}" \
|
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}" \
|
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}' `
|
||||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
|
||||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
|
||||||
|
|
||||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
40
proxy-ltt.sh
40
proxy-ltt.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-TCP-TLS proxy builder"
|
>&2 echo -e "VLESS-TCP-TLS proxy builder"
|
||||||
>&2 echo "Usage: proxy-ltt <id@domain.com:443>[,xtls][,fingerprint=safari]"
|
>&2 echo -e "Usage: proxy-ltt <id@domain.com:443>[,xtls][,fingerprint=safari]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443,fingerprint=safari
|
# id@domain.com:443,fingerprint=safari
|
||||||
@@ -40,43 +39,28 @@ port="${options[1]}"
|
|||||||
|
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=443; fi
|
||||||
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
|
# User settings
|
||||||
Jusers=`jq -nc --arg uuid "${id}" --arg flow "${flow}" '. += {"flow":$flow,"id":$uuid,"encryption":"none","level":0}'`
|
Jusers=`jq -nc --arg uuid "${id}" --arg flow "${flow}" '. += {"flow":$flow,"id":$uuid,"encryption":"none","level":0}'`
|
||||||
|
|
||||||
# Vnext settings
|
# Vnext 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]}' `
|
||||||
|
|
||||||
# Stream Settings
|
# Stream Settings
|
||||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" \
|
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --argjson Jalpn "${Jalpn}" \
|
||||||
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn}}' `
|
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$Jalpn}}' `
|
||||||
|
|
||||||
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}' `
|
||||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
|
||||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
|
||||||
|
|
||||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
39
proxy-lwp.sh
39
proxy-lwp.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-WS-PLAIN proxy builder"
|
>&2 echo -e "VLESS-WS-PLAIN proxy builder"
|
||||||
>&2 echo "Usage: proxy-lwp <id@domain.com:80:/websocket>"
|
>&2 echo -e "Usage: proxy-lwp <id@domain.com:80:/websocket>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443:/websocket
|
# id@domain.com:443:/websocket
|
||||||
@@ -19,39 +18,27 @@ host="${options[0]}"
|
|||||||
port="${options[1]}"
|
port="${options[1]}"
|
||||||
path="${options[2]}"
|
path="${options[2]}"
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=80; fi
|
||||||
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}'`
|
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}" \
|
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}" \
|
JstreamSettings=`jq -nc --arg path "${path}" \
|
||||||
'. += {"network":"ws","security":"none","wsSettings":{"path":$path}}' `
|
'. += {"network":"ws","security":"none","wsSettings":{"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}' `
|
||||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
|
||||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
|
||||||
|
|
||||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
40
proxy-lwt.sh
40
proxy-lwt.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VLESS-WS-TLS proxy builder"
|
>&2 echo -e "VLESS-WS-TLS proxy builder"
|
||||||
>&2 echo "Usage: proxy-lwt <id@domain.com:443:/websocket>[,fingerprint=safari]"
|
>&2 echo -e "Usage: proxy-lwt <id@domain.com:443:/websocket>[,fingerprint=safari]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443:/websocket,fingerprint=safari
|
# id@domain.com:443:/websocket,fingerprint=safari
|
||||||
@@ -38,43 +37,28 @@ path="${options[2]}"
|
|||||||
|
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=443; fi
|
||||||
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
|
# 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}'`
|
||||||
|
|
||||||
# Vnext settings
|
# Vnext 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]}' `
|
||||||
|
|
||||||
# Stream Settings
|
# Stream Settings
|
||||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson jalpn "${Jalpn}" \
|
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}}' `
|
'. += {"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}" \
|
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}' `
|
||||||
Jdirect='{"tag":"direct","protocol":"freedom","settings":{}}'
|
|
||||||
Jblocked='{"tag":"blocked","protocol":"blackhole","settings":{}}'
|
|
||||||
|
|
||||||
jroot=`jq -n --argjson jproxy "${Jproxy}" --argjson jdirect "${Jdirect}" --argjson jblocked "${Jblocked}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
40
proxy-mtt.sh
40
proxy-mtt.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VMESS-TCP-TLS proxy builder"
|
>&2 echo -e "VMESS-TCP-TLS proxy builder"
|
||||||
>&2 echo "Usage: proxy-mtt <id@domain.com:443>[,fingerprint=safari]"
|
>&2 echo -e "Usage: proxy-mtt <id@domain.com:443>[,fingerprint=safari]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443,fingerprint=safari
|
# id@domain.com:443,fingerprint=safari
|
||||||
@@ -37,43 +36,28 @@ port="${options[1]}"
|
|||||||
|
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=443; fi
|
||||||
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
|
# 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}'`
|
||||||
|
|
||||||
# Vnext settings
|
# Vnext 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]}' `
|
||||||
|
|
||||||
# Stream Settings
|
# Stream Settings
|
||||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --argjson jalpn "${Jalpn}" \
|
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --argjson Jalpn "${Jalpn}" \
|
||||||
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn}}' `
|
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$Jalpn}}' `
|
||||||
|
|
||||||
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":"vmess","settings":{"vnext":[$jvnext]},"streamSettings":$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}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
44
proxy-mwp.sh
44
proxy-mwp.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VMESS-WS-PLAIN proxy builder"
|
>&2 echo -e "VMESS-WS-PLAIN proxy builder"
|
||||||
>&2 echo "Usage: proxy-mwp <id@domain.com:443:/websocket>"
|
>&2 echo -e "Usage: proxy-mwp <id@domain.com:443:/websocket>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443:/websocket
|
# id@domain.com:443:/websocket
|
||||||
@@ -19,42 +18,27 @@ host="${options[0]}"
|
|||||||
port="${options[1]}"
|
port="${options[1]}"
|
||||||
path="${options[2]}"
|
path="${options[2]}"
|
||||||
|
|
||||||
if [ -z "${serverName}" ]; then serverName=${host}; fi
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${port}" ]; then port=80; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if ! [ "${port}" -eq "${port}" ] 2>/dev/null; then >&2 echo -e "Port number must be numeric.\n"; exit 1; fi
|
||||||
port=443
|
|
||||||
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}'`
|
||||||
|
|
||||||
|
# Vnext 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]}' `
|
||||||
|
|
||||||
|
# Stream Settings
|
||||||
JstreamSettings=`jq -nc --arg path "${path}" \
|
JstreamSettings=`jq -nc --arg path "${path}" \
|
||||||
'. += {"network":"ws","security":"none","wsSettings":{"path":$path}}' `
|
'. += {"network":"ws","security":"none","wsSettings":{"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":"vmess","settings":{"vnext":[$jvnext]},"streamSettings":$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}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
42
proxy-mwt.sh
42
proxy-mwt.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "VMESS-WS-TLS proxy builder"
|
>&2 echo -e "VMESS-WS-TLS proxy builder"
|
||||||
>&2 echo "Usage: proxy-mwt <id@domain.com:443:/websocket>[,fingerprint=safari]"
|
>&2 echo -e "Usage: proxy-mwt <id@domain.com:443:/websocket>[,fingerprint=safari]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# id@domain.com:443:/websocket,fingerprint=safari
|
# id@domain.com:443:/websocket,fingerprint=safari
|
||||||
@@ -38,43 +37,28 @@ path="${options[2]}"
|
|||||||
|
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||||
|
|
||||||
if [ -z "${id}" ]; then
|
if [ -z "${id}" ]; then >&2 echo -e "Error: id undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: id undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=443; fi
|
||||||
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
|
# 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}'`
|
||||||
|
|
||||||
# Vnext settings
|
# Vnext 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]}' `
|
||||||
|
|
||||||
# Stream Settings
|
# Stream Settings
|
||||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson jalpn "${Jalpn}" \
|
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}}' `
|
'. += {"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}" \
|
Jproxy=`jq -nc --arg host "${host}" --argjson jvnext "${Jvnext}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||||
'. += { "tag":"proxy","protocol":"vmess","settings":{"vnext":[$jvnext]},"streamSettings":$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}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
42
proxy-ttt.sh
42
proxy-ttt.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "TROJAN-TCP-TLS proxy builder"
|
>&2 echo -e "TROJAN-TCP-TLS proxy builder"
|
||||||
>&2 echo "Usage: proxy-ttt <password@domain.com:443>[,fingerprint=safari]"
|
>&2 echo -e "Usage: proxy-ttt <password@domain.com:443>[,fingerprint=safari]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# password@domain.com:443,fingerprint=safari
|
# password@domain.com:443,fingerprint=safari
|
||||||
@@ -38,40 +37,25 @@ passwd="${id}"
|
|||||||
|
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||||
|
|
||||||
if [ -z "${passwd}" ]; then
|
if [ -z "${passwd}" ]; then >&2 echo -e "Error: password undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: password undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=443; fi
|
||||||
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
|
# User settings
|
||||||
Jservers=`jq -nc --arg host "${host}" --arg port "${port}" --arg passwd "${passwd}" \
|
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
|
# Stream Settings
|
||||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --argjson jalpn "${Jalpn}" \
|
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --argjson Jalpn "${Jalpn}" \
|
||||||
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$jalpn}}' `
|
'. += {"network":"tcp","security":"tls","tlsSettings":{"serverName":$serverName,"fingerprint":$fingerprint,"alpn":$Jalpn}}' `
|
||||||
|
|
||||||
Jproxy=`jq -nc --arg host "${host}" --argjson jservers "${Jservers}" --argjson jstreamSettings "${JstreamSettings}" \
|
Jproxy=`jq -nc --arg host "${host}" --argjson jservers "${Jservers}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||||
'. += { "tag":"proxy","protocol":"trojan","settings":{"servers":[$jservers]},"streamSettings":$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}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
36
proxy-twp.sh
36
proxy-twp.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "TROJAN-WS-PLAIN proxy builder"
|
>&2 echo -e "TROJAN-WS-PLAIN proxy builder"
|
||||||
>&2 echo "Usage: proxy-twp <password@domain.com:443:/websocket>"
|
>&2 echo -e "Usage: proxy-twp <password@domain.com:443:/websocket>"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# password@domain.com:443:/websocket
|
# password@domain.com:443:/websocket
|
||||||
@@ -20,27 +19,17 @@ port="${options[1]}"
|
|||||||
path="${options[2]}"
|
path="${options[2]}"
|
||||||
passwd="${id}"
|
passwd="${id}"
|
||||||
|
|
||||||
if [ -z "${passwd}" ]; then
|
if [ -z "${passwd}" ]; then >&2 echo -e "Error: password undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: password undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=80; fi
|
||||||
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
|
# User settings
|
||||||
Jservers=`jq -nc --arg host "${host}" --arg port "${port}" --arg passwd "${passwd}" \
|
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
|
# Stream Settings
|
||||||
JstreamSettings=`jq -nc --arg path "${path}" \
|
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}" \
|
Jproxy=`jq -nc --arg host "${host}" --argjson jservers "${Jservers}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||||
'. += { "tag":"proxy","protocol":"trojan","settings":{"servers":[$jservers]},"streamSettings":$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}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
42
proxy-twt.sh
42
proxy-twt.sh
@@ -1,14 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
>&2 echo "TROJAN-WS-TLS proxy builder"
|
>&2 echo -e "TROJAN-WS-TLS proxy builder"
|
||||||
>&2 echo "Usage: proxy-twt <password@domain.com:443:/websocket>[,fingerprint=safari]"
|
>&2 echo -e "Usage: proxy-twt <password@domain.com:443:/websocket>[,fingerprint=safari]"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
if [ -z "$1" ]; then
|
||||||
>&2 echo "Missing options"
|
>&2 echo -e "Missing command options.\n"
|
||||||
usage
|
usage; exit 1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# password@domain.com:443:/websocket,fingerprint=safari
|
# password@domain.com:443:/websocket,fingerprint=safari
|
||||||
@@ -39,40 +38,25 @@ passwd="${id}"
|
|||||||
|
|
||||||
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
if [ -z "${fingerprint}" ]; then fingerprint="safari"; fi
|
||||||
|
|
||||||
if [ -z "${passwd}" ]; then
|
if [ -z "${passwd}" ]; then >&2 echo -e "Error: password undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: password undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${host}" ]; then
|
if [ -z "${host}" ]; then >&2 echo -e "Error: destination host undefined.\n"; usage; exit 1; fi
|
||||||
>&2 echo "Error: destination host undefined."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${port}" ]; then
|
if [ -z "${port}" ]; then port=443; fi
|
||||||
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
|
# User settings
|
||||||
Jservers=`jq -nc --arg host "${host}" --arg port "${port}" --arg passwd "${passwd}" \
|
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
|
# Stream Settings
|
||||||
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
Jalpn=`printf '%s\n' "${ALPN[@]}"|jq -R|jq -sc`
|
||||||
JstreamSettings=`jq -nc --arg serverName "${serverName}" --arg fingerprint "${fingerprint}" --arg path "${path}" --argjson jalpn "${Jalpn}" \
|
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}}' `
|
'. += {"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}" \
|
Jproxy=`jq -nc --arg host "${host}" --argjson jservers "${Jservers}" --argjson jstreamSettings "${JstreamSettings}" \
|
||||||
'. += { "tag":"proxy","protocol":"trojan","settings":{"servers":[$jservers]},"streamSettings":$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}" \
|
echo "$Jproxy"
|
||||||
'. += {"log":{"loglevel":"warning"},"outbounds":[$jproxy,$jdirect,$jblocked]}' `
|
|
||||||
|
|
||||||
echo "$jroot"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
111
run.sh
111
run.sh
@@ -26,7 +26,7 @@ usage() {
|
|||||||
echo " --twt <TROJAN-WS-TLS option> password@host:port:/wspath"
|
echo " --twt <TROJAN-WS-TLS option> password@host:port:/wspath"
|
||||||
echo " -d|--debug Start in debug mode with verbose output"
|
echo " -d|--debug Start in debug mode with verbose output"
|
||||||
echo " -i|--stdin Read config from stdin instead of auto generation"
|
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 <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 <local-conf-file> Enable designated domain conf file. Like apple.china.conf"
|
||||||
echo " --dns-local-cn Enable China-accessible domains to be resolved in China"
|
echo " --dns-local-cn Enable China-accessible domains to be resolved in China"
|
||||||
@@ -50,39 +50,20 @@ while true ; do
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
--lgp|--lgr|--lgt|--lsp|--lst|--ltr|--ltt|--lwp|--lwt|--mtt|--mwp|--mwt|--ttt|--twp|--twt)
|
--lgp|--lgr|--lgt|--lsp|--lst|--ltr|--ltt|--lwp|--lwt|--mtt|--mwp|--mwt|--ttt|--twp|--twt)
|
||||||
subcmd=`echo "$1"|tr -d "\-\-"`
|
subcmd=`echo "$1"|tr -d "\-\-"`
|
||||||
$DIR/proxy-${subcmd}.sh $2 >$XCONF
|
PXCMD="$DIR/proxy-${subcmd}.sh $2"
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo "${subcmd} Config failed: $DIR/proxy-${subcmd}.sh $2"
|
|
||||||
exit 2
|
|
||||||
else
|
|
||||||
XRAYCFG=1
|
|
||||||
fi
|
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--ltrx|--lttx)
|
--ltrx|--lttx)
|
||||||
# Alias of --ltr|ltt options
|
# Alias of --ltr|ltt options
|
||||||
subcmd=`echo $1|tr -d '\-\-'|tr -d x`
|
subcmd=`echo $1|tr -d '\-\-'|tr -d x`
|
||||||
$DIR/proxy-${subcmd}.sh $2,xtls >$XCONF
|
PXCMD="$DIR/proxy-${subcmd}.sh $2,xtls"
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo "${subcmd} Config failed: $DIR/proxy-${subcmd}.sh $2"
|
|
||||||
exit 2
|
|
||||||
else
|
|
||||||
XRAYCFG=1
|
|
||||||
fi
|
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--lst3)
|
--lst3)
|
||||||
# Alias of --lst options
|
# Alias of --lst options
|
||||||
# splitHTTP is the only option for H3 support from Xray-Core so far.
|
# splitHTTP is the only option for H3 support from Xray-Core so far.
|
||||||
subcmd=`echo $1|tr -d '\-\-'|tr -d 3`
|
subcmd=`echo $1|tr -d '\-\-'|tr -d 3`
|
||||||
echo $subcmd
|
PXCMD="$DIR/proxy-${subcmd}.sh $2,alpn=h3"
|
||||||
$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
|
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
--dns)
|
--dns)
|
||||||
@@ -152,8 +133,7 @@ while true ; do
|
|||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-i|--stdin)
|
-i|--stdin)
|
||||||
STDINCONF=1
|
exec /usr/local/bin/xray
|
||||||
XRAYCFG=1
|
|
||||||
shift 1
|
shift 1
|
||||||
;;
|
;;
|
||||||
-d|--debug)
|
-d|--debug)
|
||||||
@@ -171,10 +151,42 @@ while true ; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "${XRAYCFG}" != "1" ]; then
|
if [ -z "${PXCMD}" ]; then >&2 echo -e "Missing Xray connection option.\n"; usage; exit 1; fi
|
||||||
echo "Missing Xray connection option"
|
|
||||||
usage
|
# Init root config
|
||||||
exit 1
|
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
|
fi
|
||||||
|
|
||||||
if [ -n "${DNSLOCAL}" ]; then
|
if [ -n "${DNSLOCAL}" ]; then
|
||||||
@@ -186,43 +198,6 @@ fi
|
|||||||
echo -e "no-resolv\nserver=127.0.0.1#5353" >/etc/dnsmasq.d/upstream.conf
|
echo -e "no-resolv\nserver=127.0.0.1#5353" >/etc/dnsmasq.d/upstream.conf
|
||||||
/usr/sbin/dnsmasq
|
/usr/sbin/dnsmasq
|
||||||
|
|
||||||
if [ -z "${DNS}" ]; then
|
jq -n "$Jroot"
|
||||||
DNS="1.1.1.1"
|
jq -n "$Jroot">$XCONF
|
||||||
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
|
|
||||||
|
|
||||||
exec /usr/local/bin/xray -c $XCONF
|
exec /usr/local/bin/xray -c $XCONF
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user