mirror of
https://github.com/fscarmen/sing-box.git
synced 2026-08-10 17:55:16 +08:00
v1.3.4 Chore: upgrade SS encryption method to SS-2022 spec.
This commit is contained in:
+19
-19
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# 脚本更新日期 2025.12.21
|
||||
# 脚本更新日期 2026.02.08
|
||||
set -e
|
||||
|
||||
WORK_DIR=/sing-box
|
||||
@@ -34,7 +34,7 @@ check_latest_sing-box() {
|
||||
|
||||
# 获取最终版本号
|
||||
local VERSION=$(wget --no-check-certificate --tries=2 --timeout=3 -qO- https://api.github.com/repos/SagerNet/sing-box/releases | awk -F '["v]' -v var="tag_name.*$FORCE_VERSION" '$0 ~ var {print $5; exit}')
|
||||
VERSION=${VERSION:-'1.13.0-beta.7'}
|
||||
VERSION=${VERSION:-'1.13.0-rc.3'}
|
||||
|
||||
echo "$VERSION"
|
||||
}
|
||||
@@ -132,7 +132,8 @@ install() {
|
||||
local REALITY_KEYPAIR=$(${WORK_DIR}/sing-box generate reality-keypair) && REALITY_PRIVATE=$(awk '/PrivateKey/{print $NF}' <<< "$REALITY_KEYPAIR") && REALITY_PUBLIC=$(awk '/PublicKey/{print $NF}' <<< "$REALITY_KEYPAIR")
|
||||
fi
|
||||
|
||||
local SHADOWTLS_PASSWORD=$(${WORK_DIR}/sing-box generate rand --base64 16)
|
||||
local SIP022_PASSWORD=$(${WORK_DIR}/sing-box generate rand --base64 16)
|
||||
local SIP022_METHOD="2022-blake3-aes-128-gcm"
|
||||
local UUID=${UUID:-"$(${WORK_DIR}/sing-box generate uuid)"}
|
||||
local NODE_NAME=${NODE_NAME:-"sing-box"}
|
||||
local CDN=${CDN:-"skk.moe"}
|
||||
@@ -157,7 +158,6 @@ install() {
|
||||
|
||||
# 生成 log 配置
|
||||
cat > ${WORK_DIR}/conf/00_log.json << EOF
|
||||
|
||||
{
|
||||
"log":{
|
||||
"disabled":false,
|
||||
@@ -428,8 +428,8 @@ EOF
|
||||
"tag":"shadowtls-in",
|
||||
"listen":"127.0.0.1",
|
||||
"network":"tcp",
|
||||
"method":"2022-blake3-aes-128-gcm",
|
||||
"password":"${SHADOWTLS_PASSWORD}",
|
||||
"method":"${SIP022_METHOD}",
|
||||
"password":"${SIP022_PASSWORD}",
|
||||
"multiplex":{
|
||||
"enabled":true,
|
||||
"padding":true,
|
||||
@@ -453,8 +453,8 @@ EOF
|
||||
"tag":"${NODE_NAME} shadowsocks",
|
||||
"listen":"::",
|
||||
"listen_port":${PORT_SHADOWSOCKS},
|
||||
"method":"aes-128-gcm",
|
||||
"password":"${UUID}",
|
||||
"method":"${SIP022_METHOD}",
|
||||
"password":"${SIP022_PASSWORD}",
|
||||
"multiplex":{
|
||||
"enabled":true,
|
||||
"padding":true,
|
||||
@@ -1004,11 +1004,11 @@ EOF
|
||||
local CLASH_SUBSCRIBE+="
|
||||
$CLASH_TUIC
|
||||
"
|
||||
[ "${SHADOWTLS}" = 'true' ] && local CLASH_SHADOWTLS="- {name: \"${NODE_NAME} ShadowTLS\", type: ss, server: ${SERVER_IP}, port: ${PORT_SHADOWTLS}, cipher: 2022-blake3-aes-128-gcm, password: ${SHADOWTLS_PASSWORD}, plugin: shadow-tls, client-fingerprint: firefox, plugin-opts: {host: addons.mozilla.org, password: \"${UUID}\", version: 3}, smux: { enabled: true, protocol: 'h2mux', padding: true, max-connections: '8', min-streams: '16', statistic: true, only-tcp: false }, brutal-opts: { enabled: ${IS_BRUTAL}, up: '1000 Mbps', down: '1000 Mbps' } }" &&
|
||||
[ "${SHADOWTLS}" = 'true' ] && local CLASH_SHADOWTLS="- {name: \"${NODE_NAME} ShadowTLS\", type: ss, server: ${SERVER_IP}, port: ${PORT_SHADOWTLS}, cipher: ${SIP022_METHOD}, password: ${SIP022_PASSWORD}, plugin: shadow-tls, client-fingerprint: firefox, plugin-opts: {host: addons.mozilla.org, password: \"${UUID}\", version: 3}, smux: { enabled: true, protocol: 'h2mux', padding: true, max-connections: '8', min-streams: '16', statistic: true, only-tcp: false }, brutal-opts: { enabled: ${IS_BRUTAL}, up: '1000 Mbps', down: '1000 Mbps' } }" &&
|
||||
local CLASH_SUBSCRIBE+="
|
||||
$CLASH_SHADOWTLS
|
||||
"
|
||||
[ "${SHADOWSOCKS}" = 'true' ] && local CLASH_SHADOWSOCKS="- {name: \"${NODE_NAME} shadowsocks\", type: ss, server: ${SERVER_IP}, port: $PORT_SHADOWSOCKS, cipher: aes-128-gcm, password: ${UUID}, smux: { enabled: true, protocol: 'h2mux', padding: true, max-connections: '8', min-streams: '16', statistic: true, only-tcp: false }, brutal-opts: { enabled: ${IS_BRUTAL}, up: '1000 Mbps', down: '1000 Mbps' } }" &&
|
||||
[ "${SHADOWSOCKS}" = 'true' ] && local CLASH_SHADOWSOCKS="- {name: \"${NODE_NAME} shadowsocks\", type: ss, server: ${SERVER_IP}, port: $PORT_SHADOWSOCKS, cipher: ${SIP022_METHOD}, password: ${UUID}, smux: { enabled: true, protocol: 'h2mux', padding: true, max-connections: '8', min-streams: '16', statistic: true, only-tcp: false }, brutal-opts: { enabled: ${IS_BRUTAL}, up: '1000 Mbps', down: '1000 Mbps' } }" &&
|
||||
local CLASH_SUBSCRIBE+="
|
||||
$CLASH_SHADOWSOCKS
|
||||
"
|
||||
@@ -1056,10 +1056,10 @@ hysteria2://${UUID}@${SERVER_IP_1}:${PORT_HYSTERIA2}?peer=addons.mozilla.org&hpk
|
||||
tuic://${UUID}:${UUID}@${SERVER_IP_2}:${PORT_TUIC}?peer=addons.mozilla.org&congestion_control=bbr&udp_relay_mode=native&alpn=h3&hpkp=${SELF_SIGNED_FINGERPRINT_SHA256}#${NODE_NAME// /%20}%20tuic
|
||||
"
|
||||
[ "${SHADOWTLS}" = 'true' ] && local SHADOWROCKET_SUBSCRIBE+="
|
||||
ss://$(echo -n "2022-blake3-aes-128-gcm:${SHADOWTLS_PASSWORD}@${SERVER_IP_2}:${PORT_SHADOWTLS}" | base64 -w0)?shadow-tls=$(echo -n "{\"version\":\"3\",\"host\":\"addons.mozilla.org\",\"password\":\"${UUID}\"}" | base64 -w0)#${NODE_NAME// /%20}%20ShadowTLS
|
||||
ss://$(echo -n "${SIP022_METHOD}:${SIP022_PASSWORD}@${SERVER_IP_2}:${PORT_SHADOWTLS}" | base64 -w0)?shadow-tls=$(echo -n "{\"version\":\"3\",\"host\":\"addons.mozilla.org\",\"password\":\"${UUID}\"}" | base64 -w0)#${NODE_NAME// /%20}%20ShadowTLS
|
||||
"
|
||||
[ "${SHADOWSOCKS}" = 'true' ] && local SHADOWROCKET_SUBSCRIBE+="
|
||||
ss://$(echo -n "aes-128-gcm:${UUID}@${SERVER_IP_2}:$PORT_SHADOWSOCKS" | base64 -w0)#${NODE_NAME// /%20}%20shadowsocks
|
||||
ss://$(echo -n "${SIP022_METHOD}:${UUID}@${SERVER_IP_2}:$PORT_SHADOWSOCKS" | base64 -w0)#${NODE_NAME// /%20}%20shadowsocks
|
||||
"
|
||||
[ "${TROJAN}" = 'true' ] && local SHADOWROCKET_SUBSCRIBE+="
|
||||
trojan://${UUID}@${SERVER_IP_1}:$PORT_TROJAN?peer=addons.mozilla.org&hpkp=${SELF_SIGNED_FINGERPRINT_SHA256}#${NODE_NAME// /%20}%20trojan
|
||||
@@ -1118,8 +1118,8 @@ tuic://${UUID}:${UUID}@${SERVER_IP_1}:${PORT_TUIC}?sni=addons.mozilla.org&alpn=h
|
||||
\"outbounds\":[
|
||||
{
|
||||
\"detour\":\"shadowtls-out\",
|
||||
\"method\":\"2022-blake3-aes-128-gcm\",
|
||||
\"password\":\"${SHADOWTLS_PASSWORD}\",
|
||||
\"method\":\"${SIP022_METHOD}\",
|
||||
\"password\":\"${SIP022_PASSWORD}\",
|
||||
\"type\":\"shadowsocks\",
|
||||
\"udp_over_tcp\": false,
|
||||
\"multiplex\": {
|
||||
@@ -1150,7 +1150,7 @@ tuic://${UUID}:${UUID}@${SERVER_IP_1}:${PORT_TUIC}?sni=addons.mozilla.org&alpn=h
|
||||
}"
|
||||
[ "${SHADOWSOCKS}" = 'true' ] && local V2RAYN_SUBSCRIBE+="
|
||||
----------------------------
|
||||
ss://$(echo -n "aes-128-gcm:${UUID}@${SERVER_IP_1}:$PORT_SHADOWSOCKS" | base64 -w0)#${NODE_NAME// /%20}%20shadowsocks"
|
||||
ss://$(echo -n "${SIP022_METHOD}:${UUID}@${SERVER_IP_1}:$PORT_SHADOWSOCKS" | base64 -w0)#${NODE_NAME// /%20}%20shadowsocks"
|
||||
|
||||
[ "${TROJAN}" = 'true' ] && local V2RAYN_SUBSCRIBE+="
|
||||
----------------------------
|
||||
@@ -1195,11 +1195,11 @@ tuic://${UUID}:${UUID}@${SERVER_IP_1}:${PORT_TUIC}?congestion_control=bbr&alpn=h
|
||||
----------------------------
|
||||
nekoray://custom#$(echo -n "{\"_v\":0,\"addr\":\"127.0.0.1\",\"cmd\":[\"\"],\"core\":\"internal\",\"cs\":\"{\n \\\"password\\\": \\\"${UUID}\\\",\n \\\"server\\\": \\\"${SERVER_IP_1}\\\",\n \\\"server_port\\\": ${PORT_SHADOWTLS},\n \\\"tag\\\": \\\"shadowtls-out\\\",\n \\\"tls\\\": {\n \\\"enabled\\\": true,\n \\\"server_name\\\": \\\"addons.mozilla.org\\\"\n },\n \\\"type\\\": \\\"shadowtls\\\",\n \\\"version\\\": 3\n}\n\",\"mapping_port\":0,\"name\":\"1-tls-not-use\",\"port\":1080,\"socks_port\":0}" | base64 -w0)
|
||||
|
||||
nekoray://shadowsocks#$(echo -n "{\"_v\":0,\"method\":\"2022-blake3-aes-128-gcm\",\"name\":\"2-ss-not-use\",\"pass\":\"${SHADOWTLS_PASSWORD}\",\"port\":0,\"stream\":{\"ed_len\":0,\"insecure\":false,\"mux_s\":0,\"net\":\"tcp\"},\"uot\":0}" | base64 -w0)"
|
||||
nekoray://shadowsocks#$(echo -n "{\"_v\":0,\"method\":\"${SIP022_METHOD}\",\"name\":\"2-ss-not-use\",\"pass\":\"${SIP022_PASSWORD}\",\"port\":0,\"stream\":{\"ed_len\":0,\"insecure\":false,\"mux_s\":0,\"net\":\"tcp\"},\"uot\":0}" | base64 -w0)"
|
||||
|
||||
[ "${SHADOWSOCKS}" = 'true' ] && local NEKOBOX_SUBSCRIBE+="
|
||||
----------------------------
|
||||
ss://$(echo -n "aes-128-gcm:${UUID}" | base64 -w0)@${SERVER_IP_1}:$PORT_SHADOWSOCKS#${NODE_NAME// /%20}%20shadowsocks"
|
||||
ss://$(echo -n "${SIP022_METHOD}:${UUID}" | base64 -w0)@${SERVER_IP_1}:$PORT_SHADOWSOCKS#${NODE_NAME// /%20}%20shadowsocks"
|
||||
|
||||
[ "${TROJAN}" = 'true' ] && local NEKOBOX_SUBSCRIBE+="
|
||||
----------------------------
|
||||
@@ -1246,11 +1246,11 @@ anytls://${UUID}@${SERVER_IP_1}:${PORT_ANYTLS}?security=tls&sni=addons.mozilla.o
|
||||
local NODE_REPLACE+="\"${NODE_NAME} tuic\","
|
||||
|
||||
[ "${SHADOWTLS}" = 'true' ] &&
|
||||
local OUTBOUND_REPLACE+=" { \"type\": \"shadowsocks\", \"tag\": \"${NODE_NAME} ShadowTLS\", \"method\": \"2022-blake3-aes-128-gcm\", \"password\": \"${SHADOWTLS_PASSWORD}\", \"detour\": \"shadowtls-out\", \"udp_over_tcp\": false, \"multiplex\": { \"enabled\": true, \"protocol\": \"h2mux\", \"max_connections\": 8, \"min_streams\": 16, \"padding\": true, \"brutal\":{ \"enabled\":${IS_BRUTAL}, \"up_mbps\":1000, \"down_mbps\":1000 } } }, { \"type\": \"shadowtls\", \"tag\": \"shadowtls-out\", \"server\": \"${SERVER_IP}\", \"server_port\": ${PORT_SHADOWTLS}, \"version\": 3, \"password\": \"${UUID}\", \"tls\": { \"enabled\": true, \"server_name\": \"addons.mozilla.org\", \"utls\": { \"enabled\": true, \"fingerprint\": \"firefox\" } } }," &&
|
||||
local OUTBOUND_REPLACE+=" { \"type\": \"shadowsocks\", \"tag\": \"${NODE_NAME} ShadowTLS\", \"method\": \"${SIP022_METHOD}\", \"password\": \"${SIP022_PASSWORD}\", \"detour\": \"shadowtls-out\", \"udp_over_tcp\": false, \"multiplex\": { \"enabled\": true, \"protocol\": \"h2mux\", \"max_connections\": 8, \"min_streams\": 16, \"padding\": true, \"brutal\":{ \"enabled\":${IS_BRUTAL}, \"up_mbps\":1000, \"down_mbps\":1000 } } }, { \"type\": \"shadowtls\", \"tag\": \"shadowtls-out\", \"server\": \"${SERVER_IP}\", \"server_port\": ${PORT_SHADOWTLS}, \"version\": 3, \"password\": \"${UUID}\", \"tls\": { \"enabled\": true, \"server_name\": \"addons.mozilla.org\", \"utls\": { \"enabled\": true, \"fingerprint\": \"firefox\" } } }," &&
|
||||
local NODE_REPLACE+="\"${NODE_NAME} ShadowTLS\","
|
||||
|
||||
[ "${SHADOWSOCKS}" = 'true' ] &&
|
||||
local OUTBOUND_REPLACE+=" { \"type\": \"shadowsocks\", \"tag\": \"${NODE_NAME} shadowsocks\", \"server\": \"${SERVER_IP}\", \"server_port\": $PORT_SHADOWSOCKS, \"method\": \"aes-128-gcm\", \"password\": \"${UUID}\", \"multiplex\": { \"enabled\": true, \"protocol\": \"h2mux\", \"max_connections\": 8, \"min_streams\": 16, \"padding\": true, \"brutal\":{ \"enabled\":${IS_BRUTAL}, \"up_mbps\":1000, \"down_mbps\":1000 } } }," &&
|
||||
local OUTBOUND_REPLACE+=" { \"type\": \"shadowsocks\", \"tag\": \"${NODE_NAME} shadowsocks\", \"server\": \"${SERVER_IP}\", \"server_port\": $PORT_SHADOWSOCKS, \"method\": \"${SIP022_METHOD}\", \"password\": \"${UUID}\", \"multiplex\": { \"enabled\": true, \"protocol\": \"h2mux\", \"max_connections\": 8, \"min_streams\": 16, \"padding\": true, \"brutal\":{ \"enabled\":${IS_BRUTAL}, \"up_mbps\":1000, \"down_mbps\":1000 } } }," &&
|
||||
local NODE_REPLACE+="\"${NODE_NAME} shadowsocks\","
|
||||
|
||||
[ "${TROJAN}" = 'true' ] &&
|
||||
|
||||
Reference in New Issue
Block a user