Default server port 443

This commit is contained in:
Samuel Huang
2024-08-26 07:58:00 +10:00
parent 3573f8ece5
commit 6e919c1dac
7 changed files with 24 additions and 26 deletions

View File

@@ -4,6 +4,8 @@ usage() {
echo "Usage: server-lpg <x=xray-config-file>,<p=listen-port>,<u=xxx-xxx[:0[:a@mail.com]]>,<s=svcname>" echo "Usage: server-lpg <x=xray-config-file>,<p=listen-port>,<u=xxx-xxx[:0[:a@mail.com]]>,<s=svcname>"
} }
port=443
options=(`echo $1 |tr ',' ' '`) options=(`echo $1 |tr ',' ' '`)
for option in "${options[@]}" for option in "${options[@]}"
do do
@@ -30,8 +32,10 @@ if [ -z "${xconf}" ]; then
exit 1 exit 1
fi fi
if [ -z "${port}" ]; then if [ -z "${service}" ]; then
port=443 echo "Error: service name undefined."
usage
exit 1
fi fi
if [ -z "${xuser}" ]; then if [ -z "${xuser}" ]; then
@@ -74,6 +78,10 @@ cat $XCONF |jq --arg port "${port}" \
'( .inbounds[] | select(.port == ($port|tonumber)) | .settings.decryption ) += "none" ' \ '( .inbounds[] | select(.port == ($port|tonumber)) | .settings.decryption ) += "none" ' \
|sponge $XCONF |sponge $XCONF
cat $XCONF |jq --arg port "${port}" --arg service "${service}" \ cat $XCONF |jq --arg port "${port}" \
'( .inbounds[] | select(.port == ($port|tonumber)) | .streamSettings ) += {"network":"grpc", "grpcSettings":{"serviceName":$service}, "security":"none"} ' \ '( .inbounds[] | select(.port == ($port|tonumber)) | .streamSettings ) += {"network":"grpc", "security":"none" } ' \
|sponge $XCONF
cat $XCONF |jq --arg port "${port}" --arg service "${service}" \
'( .inbounds[] | select(.port == ($port|tonumber)) | .streamSettings ) += {"grpcSettings":{"serviceName":$service}} ' \
|sponge $XCONF |sponge $XCONF

View File

@@ -4,6 +4,8 @@ usage() {
echo "Usage: server-lps <x=xray-config-file>,<p=listen-port>,<u=myid[:0[:a@mail.com]]>,<w=web-path>" echo "Usage: server-lps <x=xray-config-file>,<p=listen-port>,<u=myid[:0[:a@mail.com]]>,<w=web-path>"
} }
port=443
options=(`echo $1 |tr ',' ' '`) options=(`echo $1 |tr ',' ' '`)
for option in "${options[@]}" for option in "${options[@]}"
do do
@@ -33,10 +35,6 @@ if [ -z "${xconf}" ]; then
exit 1 exit 1
fi fi
if [ -z "${port}" ]; then
port=443
fi
if [ -z "${xuser}" ]; then if [ -z "${xuser}" ]; then
echo "Error: user undefined." echo "Error: user undefined."
usage usage

View File

@@ -4,6 +4,8 @@ usage() {
echo "Usage: server-lpw <x=xray-config-file>,<p=listen-port>,<u=myid[:0[:a@mail.com]]>,<w=websocket-path>" echo "Usage: server-lpw <x=xray-config-file>,<p=listen-port>,<u=myid[:0[:a@mail.com]]>,<w=websocket-path>"
} }
port=443
options=(`echo $1 |tr ',' ' '`) options=(`echo $1 |tr ',' ' '`)
for option in "${options[@]}" for option in "${options[@]}"
do do
@@ -33,10 +35,6 @@ if [ -z "${xconf}" ]; then
exit 1 exit 1
fi fi
if [ -z "${port}" ]; then
port=443
fi
if [ -z "${xuser}" ]; then if [ -z "${xuser}" ]; then
echo "Error: user undefined." echo "Error: user undefined."
usage usage

View File

@@ -4,6 +4,8 @@ usage() {
echo "Usage: server-mpw <x=xray-config-file>,<p=listen-port>,<u=myid[:0[:a@mail.com]]>,<w=websocket-path>" echo "Usage: server-mpw <x=xray-config-file>,<p=listen-port>,<u=myid[:0[:a@mail.com]]>,<w=websocket-path>"
} }
port=443
options=(`echo $1 |tr ',' ' '`) options=(`echo $1 |tr ',' ' '`)
for option in "${options[@]}" for option in "${options[@]}"
do do
@@ -33,10 +35,6 @@ if [ -z "${xconf}" ]; then
exit 1 exit 1
fi fi
if [ -z "${port}" ]; then
port=443
fi
if [ -z "${xuser}" ]; then if [ -z "${xuser}" ]; then
echo "Error: user undefined." echo "Error: user undefined."
usage usage

View File

@@ -4,6 +4,8 @@ usage() {
echo "Usage: server-tpw <x=xray-config-file>,<p=listen-port>,<u=password[:level[:email]],<w=websocket-path>" echo "Usage: server-tpw <x=xray-config-file>,<p=listen-port>,<u=password[:level[:email]],<w=websocket-path>"
} }
port=443
options=(`echo $1 |tr ',' ' '`) options=(`echo $1 |tr ',' ' '`)
for option in "${options[@]}" for option in "${options[@]}"
do do
@@ -33,10 +35,6 @@ if [ -z "${xconf}" ]; then
exit 1 exit 1
fi fi
if [ -z "${port}" ]; then
port=443
fi
if [ -z "${xuser}" ]; then if [ -z "${xuser}" ]; then
echo "Error: user undefined." echo "Error: user undefined."
usage usage
@@ -126,10 +124,6 @@ cat $XCONF |jq --arg port "${port}" \
'( .inbounds[] | select(.port == ($port|tonumber)) | .streamSettings ) += {"network":"ws", "security":"none" } ' \ '( .inbounds[] | select(.port == ($port|tonumber)) | .streamSettings ) += {"network":"ws", "security":"none" } ' \
|sponge $XCONF |sponge $XCONF
cat $XCONF |jq --arg port "${port}" \
'( .inbounds[] | select(.port == ($port|tonumber)) | .streamSettings ) += {"tlsSettings":{"alpn":["http/1.1"]} } ' \
|sponge $XCONF
cat $XCONF |jq --arg port "${port}" --arg wspath "${wspath}" \ cat $XCONF |jq --arg port "${port}" --arg wspath "${wspath}" \
'( .inbounds[] | select(.port == ($port|tonumber)) | .streamSettings ) += {"wsSettings":{"path":$wspath}} ' \ '( .inbounds[] | select(.port == ($port|tonumber)) | .streamSettings ) += {"wsSettings":{"path":$wspath}} ' \
|sponge $XCONF |sponge $XCONF

View File

@@ -145,7 +145,7 @@ cat $XCONF |jq --arg port "${port}" \
|sponge $XCONF |sponge $XCONF
cat $XCONF |jq --arg port "${port}" \ cat $XCONF |jq --arg port "${port}" \
'( .inbounds[] | select(.port == ($port|tonumber)) | .streamSettings ) += {"tlsSettings":{"alpn":["http/1.1"]} } ' \ '( .inbounds[] | select(.port == ($port|tonumber)) | .streamSettings ) += {"tlsSettings":{"alpn":["h2,http/1.1"]} } ' \
|sponge $XCONF |sponge $XCONF
cat $XCONF |jq --arg port "${port}" --arg wspath "${wspath}" \ cat $XCONF |jq --arg port "${port}" --arg wspath "${wspath}" \

View File

@@ -9,6 +9,8 @@ server {
ssl_protocols TLSv1.2 TLSv1.3; ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5; ssl_ciphers HIGH:!aNULL:!MD5;
add_header Alt-Svc 'h3=":443"; ma=86400'; add_header Alt-Svc 'h3=":443"; ma=86400';
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_header_timeout 1071906480m; client_header_timeout 1071906480m;
keepalive_timeout 1071906480m; keepalive_timeout 1071906480m;