mirror of
https://github.com/samuelhbne/server-xray.git
synced 2025-12-17 04:14:40 +03:00
Change trojan user into u=psw[:level[:email]]
This commit is contained in:
24
README.md
24
README.md
@@ -32,14 +32,14 @@ server-xray --<ltx|ltt|lttw|mtt|mttw|ttt> <options> [-r|--request-domain <domain
|
|||||||
-c|--cert-path <cert-path-root> [Optional] Reading TLS certs from folder <cert-path-root>/<domain-name>/. Multiple allowed
|
-c|--cert-path <cert-path-root> [Optional] Reading TLS certs from folder <cert-path-root>/<domain-name>/. Multiple allowed
|
||||||
-i|--stdin [Optional] Read config from stdin instead of auto generation
|
-i|--stdin [Optional] Read config from stdin instead of auto generation
|
||||||
-d|--debug [Optional] Start in debug mode with verbose output
|
-d|--debug [Optional] Start in debug mode with verbose output
|
||||||
--ltx <VLESS-TCP-XTLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]]
|
--ltx <VLESS-TCP-XTLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fb-host]:fb-port:[fb-path]]
|
||||||
--ltt <VLESS-TCP-TLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]]
|
--ltt <VLESS-TCP-TLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fb-host]:fb-port:[fb-path]]
|
||||||
--lttw <VLESS-TCP-TLS-WS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath
|
--lttw <VLESS-TCP-TLS-WS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fb-host]:fb-port:[fb-path]],w=/webpath
|
||||||
--lttg <VLESS-TCP-TLS-GRPC option> [p=443,]d=domain.com,u=id[:level[:email]],s=/svcpath,g=grpcport
|
--lttg <VLESS-TCP-TLS-GRPC option> [p=443,]d=domain.com,u=id[:level[:email]],s=/svcpath,g=grpcport
|
||||||
--mtt <VMESS-TCP-TLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]]
|
--mtt <VMESS-TCP-TLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fb-host]:fb-port:[fb-path]]
|
||||||
--mttw <VMESS-TCP-TLS-WS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath
|
--mttw <VMESS-TCP-TLS-WS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fb-host]:fb-port:[fb-path]],w=/webpath
|
||||||
--ttt <TROJAN-TCP-TLS option> [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]]
|
--ttt <TROJAN-TCP-TLS option> [p=443,]d=domain.com,u=psw[:level[:email]][,f=[fb-host]:fb-port:[fb-path]]
|
||||||
--tttw <TROJAN-TCP-TLS-WS option> [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath
|
--tttw <TROJAN-TCP-TLS-WS option> [p=443,]d=domain.com,u=psw[:level[:email]][,f=[fb-host]:fb-port:[fb-path]],w=/webpath
|
||||||
|
|
||||||
$ docker run --name server-xray -p 80:80 -p 443:2443 -d samuelhbne/server-xray \
|
$ docker run --name server-xray -p 80:80 -p 443:2443 -d samuelhbne/server-xray \
|
||||||
--ltx p=2443,d=mydomain.duckdns.org,u=myid,f=:8080 \
|
--ltx p=2443,d=mydomain.duckdns.org,u=myid,f=:8080 \
|
||||||
@@ -64,9 +64,17 @@ Try to connect the server from Xray compatible mobile app like [v2rayNG](https:/
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ docker run --rm samuelhbne/proxy-xray
|
$ docker run --rm samuelhbne/proxy-xray
|
||||||
proxy-xray --<ltx|ltt|lttw|mtt|mttw|ttt|tttw|ssa|sst|stdin> [connect options] [-i|--stdin] [-d|--debug]
|
proxy-xray <connection-options>
|
||||||
-i|--stdin [Optional] Read config from stdin instead of auto generation
|
-i|--stdin [Optional] Read config from stdin instead of auto generation
|
||||||
-d|--debug [Optional] Start in debug mode with verbose output
|
-d|--debug [Optional] Start in debug mode with verbose output
|
||||||
|
--dns <upstream-DNS-ip> [Optional] Designated upstream DNS server ip, 1.1.1.1 will be applied by default
|
||||||
|
--china-direct [Optional] Add routing rules to avoid domain and ip located in China being proxied
|
||||||
|
--domain-direct <domain-rule> [Optional] Add a domain rule for direct routing, likegeosite:geosite:geolocation-cn
|
||||||
|
--domain-proxy <domain-rule> [Optional] Add a domain rule for proxy routing, like twitter.com or geosite:google-cn
|
||||||
|
--domain-block <domain-rule> [Optional] Add a domain rule for block routing, like geosite:category-ads-all
|
||||||
|
--ip-direct <ip-rule> [Optional] Add a ip-addr rule for direct routing, like 114.114.114.114/32 or geoip:cn
|
||||||
|
--ip-proxy <ip-rule> [Optional] Add a ip-addr rule for proxy routing, like 1.1.1.1/32 or geoip:netflix
|
||||||
|
--ip-block <ip-rule> [Optional] Add a ip-addr rule for block routing, like geoip:private
|
||||||
--ltx <VLESS-TCP-XTLS option> id@host:port
|
--ltx <VLESS-TCP-XTLS option> id@host:port
|
||||||
--ltt <VLESS-TCP-TLS option> id@host:port
|
--ltt <VLESS-TCP-TLS option> id@host:port
|
||||||
--lttw <VLESS-TCP-TLS-WS option> id@host:port:/webpath
|
--lttw <VLESS-TCP-TLS-WS option> id@host:port:/webpath
|
||||||
|
|||||||
14
run.sh
14
run.sh
@@ -11,14 +11,14 @@ usage() {
|
|||||||
echo " -c|--cert-path <cert-path-root> [Optional] Reading TLS certs from folder <cert-path-root>/<domain-name>/. Multiple allowed"
|
echo " -c|--cert-path <cert-path-root> [Optional] Reading TLS certs from folder <cert-path-root>/<domain-name>/. Multiple allowed"
|
||||||
echo " -i|--stdin [Optional] Read config from stdin instead of auto generation"
|
echo " -i|--stdin [Optional] Read config from stdin instead of auto generation"
|
||||||
echo " -d|--debug [Optional] Start in debug mode with verbose output"
|
echo " -d|--debug [Optional] Start in debug mode with verbose output"
|
||||||
echo " --ltx <VLESS-TCP-XTLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]]"
|
echo " --ltx <VLESS-TCP-XTLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fb-host]:fb-port:[fb-path]]"
|
||||||
echo " --ltt <VLESS-TCP-TLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]]"
|
echo " --ltt <VLESS-TCP-TLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fb-host]:fb-port:[fb-path]]"
|
||||||
echo " --lttw <VLESS-TCP-TLS-WS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath"
|
echo " --lttw <VLESS-TCP-TLS-WS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fb-host]:fb-port:[fb-path]],w=/webpath"
|
||||||
echo " --lttg <VLESS-TCP-TLS-GRPC option> [p=443,]d=domain.com,u=id[:level[:email]],s=/svcpath,g=grpcport"
|
echo " --lttg <VLESS-TCP-TLS-GRPC option> [p=443,]d=domain.com,u=id[:level[:email]],s=/svcpath,g=grpcport"
|
||||||
echo " --mtt <VMESS-TCP-TLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]]"
|
echo " --mtt <VMESS-TCP-TLS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fb-host]:fb-port:[fb-path]]"
|
||||||
echo " --mttw <VMESS-TCP-TLS-WS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath"
|
echo " --mttw <VMESS-TCP-TLS-WS option> [p=443,]d=domain.com,u=id[:level[:email]][,f=[fb-host]:fb-port:[fb-path]],w=/webpath"
|
||||||
echo " --ttt <TROJAN-TCP-TLS option> [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]]"
|
echo " --ttt <TROJAN-TCP-TLS option> [p=443,]d=domain.com,u=psw[:level[:email]][,f=[fb-host]:fb-port:[fb-path]]"
|
||||||
echo " --tttw <TROJAN-TCP-TLS-WS option> [p=443,]d=domain.com,u=passwd[:email][,f=[fallback-host]:fb-port:[fb-path]],w=/webpath"
|
echo " --tttw <TROJAN-TCP-TLS-WS option> [p=443,]d=domain.com,u=psw[:level[:email]][,f=[fb-host]:fb-port:[fb-path]],w=/webpath"
|
||||||
# echo " --ssa <Shadowsocks-AEAD option> [port=443,]user=password1:method1[,user=password2:method2]"
|
# echo " --ssa <Shadowsocks-AEAD option> [port=443,]user=password1:method1[,user=password2:method2]"
|
||||||
# echo " --sst <Shadowsocks-TCP option> [port=443,]user=passwd,method=xxxx"
|
# echo " --sst <Shadowsocks-TCP option> [port=443,]user=passwd,method=xxxx"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ do
|
|||||||
|
|
||||||
if [ -z "${uopt[0]}" ]; then
|
if [ -z "${uopt[0]}" ]; then
|
||||||
echo "Incorrect user format: ${xu}"
|
echo "Incorrect user format: ${xu}"
|
||||||
echo "Correct user format: user=<uuid>[:level:email]"
|
echo "Correct user format: user=<uid>[:level:email]"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0:me@g.cn"
|
echo "Like: user=myid:0:nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962::me@g.cn"
|
echo "Like: user=myid::nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0"
|
echo "Like: user=myid:0"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962"
|
echo "Like: user=myid"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "${uopt[1]}" ]; then
|
if [ -z "${uopt[1]}" ]; then
|
||||||
|
|||||||
@@ -81,11 +81,11 @@ do
|
|||||||
|
|
||||||
if [ -z "${uopt[0]}" ]; then
|
if [ -z "${uopt[0]}" ]; then
|
||||||
echo "Incorrect user format: ${xu}"
|
echo "Incorrect user format: ${xu}"
|
||||||
echo "Correct user format: user=<uuid>[:level:email]"
|
echo "Correct user format: user=<uid>[:level:email]"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0:me@g.cn"
|
echo "Like: user=myid:0:nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962::me@g.cn"
|
echo "Like: user=myid::nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0"
|
echo "Like: user=myid:0"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962"
|
echo "Like: user=myid"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "${uopt[1]}" ]; then
|
if [ -z "${uopt[1]}" ]; then
|
||||||
|
|||||||
@@ -80,11 +80,11 @@ do
|
|||||||
|
|
||||||
if [ -z "${uopt[0]}" ]; then
|
if [ -z "${uopt[0]}" ]; then
|
||||||
echo "Incorrect user format: ${xu}"
|
echo "Incorrect user format: ${xu}"
|
||||||
echo "Correct user format: user=<uuid>[:level:email]"
|
echo "Correct user format: user=<uid>[:level:email]"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0:me@g.cn"
|
echo "Like: user=myid:0:nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962::me@g.cn"
|
echo "Like: user=myid::nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0"
|
echo "Like: user=myid:0"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962"
|
echo "Like: user=myid"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "${uopt[1]}" ]; then
|
if [ -z "${uopt[1]}" ]; then
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ do
|
|||||||
|
|
||||||
if [ -z "${uopt[0]}" ]; then
|
if [ -z "${uopt[0]}" ]; then
|
||||||
echo "Incorrect user format: ${xu}"
|
echo "Incorrect user format: ${xu}"
|
||||||
echo "Correct user format: user=<uuid>[:level:email]"
|
echo "Correct user format: user=<uid>[:level:email]"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0:me@g.cn"
|
echo "Like: user=myid:0:nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962::me@g.cn"
|
echo "Like: user=myid::nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0"
|
echo "Like: user=myid:0"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962"
|
echo "Like: user=myid"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "${uopt[1]}" ]; then
|
if [ -z "${uopt[1]}" ]; then
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ do
|
|||||||
|
|
||||||
if [ -z "${uopt[0]}" ]; then
|
if [ -z "${uopt[0]}" ]; then
|
||||||
echo "Incorrect user format: ${xu}"
|
echo "Incorrect user format: ${xu}"
|
||||||
echo "Correct user format: user=<uuid>[:level:email]"
|
echo "Correct user format: user=<uid>[:level:email]"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0:me@g.cn"
|
echo "Like: user=myid:0:nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962::me@g.cn"
|
echo "Like: user=myid::nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0"
|
echo "Like: user=myid:0"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962"
|
echo "Like: user=myid"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "${uopt[1]}" ]; then
|
if [ -z "${uopt[1]}" ]; then
|
||||||
|
|||||||
@@ -80,11 +80,11 @@ do
|
|||||||
|
|
||||||
if [ -z "${uopt[0]}" ]; then
|
if [ -z "${uopt[0]}" ]; then
|
||||||
echo "Incorrect user format: ${xu}"
|
echo "Incorrect user format: ${xu}"
|
||||||
echo "Correct user format: user=<uuid>[:level:email]"
|
echo "Correct user format: user=<uid>[:level:email]"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0:me@g.cn"
|
echo "Like: user=myid:0:nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962::me@g.cn"
|
echo "Like: user=myid::nobody@g.cn"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962:0"
|
echo "Like: user=myid:0"
|
||||||
echo "Like: user=805b2209-c26f-48d6-ba52-07b7d894f962"
|
echo "Like: user=myid"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "${uopt[1]}" ]; then
|
if [ -z "${uopt[1]}" ]; then
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: server-ttt <xconf=xray-config-file>,<certpath=cert-path-root>,<port=443>,<domain=mydomain.com>,<user=password[:0[:a@mail.com]]>[,fallback=www.baidu.com:443:/html][,fallback=:2443:/websocket2]"
|
echo "Usage: server-ttt <xconf=xray-config-file>,<certpath=cert-path-root>,<port=443>,<domain=mydomain.com>,<user=password[:level[:email]]>[,fallback=www.baidu.com:443:/html][,fallback=:2443:/websocket2]"
|
||||||
}
|
}
|
||||||
|
|
||||||
options=(`echo $1 |tr ',' ' '`)
|
options=(`echo $1 |tr ',' ' '`)
|
||||||
@@ -71,16 +71,21 @@ do
|
|||||||
|
|
||||||
if [ -z "${uopt[0]}" ]; then
|
if [ -z "${uopt[0]}" ]; then
|
||||||
echo "Incorrect user format: ${xu}"
|
echo "Incorrect user format: ${xu}"
|
||||||
echo "Correct user format: user=<password>[:email]"
|
echo "Correct user format: user=password[:level[:email]"
|
||||||
echo "Like: user=trojan_pass:me@g.cn"
|
echo "Like: user=mypass:0:me@g.cn"
|
||||||
echo "Like: user=trojan_pass"
|
echo "Like: user=mypass::me@g.cn"
|
||||||
|
echo "Like: user=mypass:0"
|
||||||
|
echo "Like: user=mypass"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "${uopt[1]}" ]; then
|
if [ -z "${uopt[1]}" ]; then
|
||||||
uopt[1]="nobody@g.cn"
|
uopt[1]=0
|
||||||
fi
|
fi
|
||||||
cat $XCONF |jq --arg port "${port}" --arg password "${uopt[0]}" --arg email "${uopt[1]}" \
|
if [ -z "${uopt[2]}" ]; then
|
||||||
'( .inbounds[] | select(.port == ($port|tonumber)) | .settings.clients ) += [ {"password":$password, "email":$email} ] ' \
|
uopt[2]="nobody@g.cn"
|
||||||
|
fi
|
||||||
|
cat $XCONF |jq --arg port "${port}" --arg pass "${uopt[0]}" --arg level "${uopt[1]}" --arg email "${uopt[2]}" \
|
||||||
|
'( .inbounds[] | select(.port == ($port|tonumber)) | .settings.clients ) += [ {"password":$pass, "level":($level|tonumber), "email":$email} ] ' \
|
||||||
|sponge $XCONF
|
|sponge $XCONF
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: server-tttw <xconf=xray-config-file>,<certpath=cert-path-root>,<port=443>,<domain=mydomain.com>,<user=password[:a@mail.com]>,<path=websocket-path>[,fallback=www.baidu.com:443:/html][,fallback=:2443:/websocket2]"
|
echo "Usage: server-tttw <xconf=xray-config-file>,<certpath=cert-path-root>,<port=443>,<domain=mydomain.com>,<user=password[:level[:email]],<path=websocket-path>[,fallback=www.baidu.com:443:/html][,fallback=:2443:/websocket2]"
|
||||||
}
|
}
|
||||||
|
|
||||||
options=(`echo $1 |tr ',' ' '`)
|
options=(`echo $1 |tr ',' ' '`)
|
||||||
@@ -80,16 +80,21 @@ do
|
|||||||
|
|
||||||
if [ -z "${uopt[0]}" ]; then
|
if [ -z "${uopt[0]}" ]; then
|
||||||
echo "Incorrect user format: ${xu}"
|
echo "Incorrect user format: ${xu}"
|
||||||
echo "Correct user format: user=<password>[:email]"
|
echo "Correct user format: user=password[:level[:email]"
|
||||||
echo "Like: user=trojan_pass:me@g.cn"
|
echo "Like: user=mypass:0:me@g.cn"
|
||||||
echo "Like: user=trojan_pass"
|
echo "Like: user=mypass::me@g.cn"
|
||||||
|
echo "Like: user=mypass:0"
|
||||||
|
echo "Like: user=mypass"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ -z "${uopt[1]}" ]; then
|
if [ -z "${uopt[1]}" ]; then
|
||||||
uopt[1]="nobody@g.cn"
|
uopt[1]=0
|
||||||
fi
|
fi
|
||||||
cat $XCONF |jq --arg port "${port}" --arg password "${uopt[0]}" --arg email "${uopt[1]}" \
|
if [ -z "${uopt[2]}" ]; then
|
||||||
'( .inbounds[] | select(.port == ($port|tonumber)) | .settings.clients ) += [ {"password":$password, "email":$email} ] ' \
|
uopt[2]="nobody@g.cn"
|
||||||
|
fi
|
||||||
|
cat $XCONF |jq --arg port "${port}" --arg pass "${uopt[0]}" --arg level "${uopt[1]}" --arg email "${uopt[2]}" \
|
||||||
|
'( .inbounds[] | select(.port == ($port|tonumber)) | .settings.clients ) += [ {"password":$pass, "level":($level|tonumber), "email":$email} ] ' \
|
||||||
|sponge $XCONF
|
|sponge $XCONF
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user