mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-10 05:58:11 +08:00
update 2026-10-21 06:53:29
This commit is contained in:
1 parent
ee55ecd1ef
commit
f144cc6010
238 files changed
+301
-19729
No files matched your search
@@ -992,6 +992,8 @@ use_mihomo_for_ss_rust_server() {
|
||||
}
|
||||
|
||||
start_v2ray_with_mihomo() {
|
||||
# These nodes use Xray-specific settings.
|
||||
case "$(uci_get_by_name "$1" v2ray_protocol)" in naive|shadowsocksr) return 1 ;; esac
|
||||
local sid="$1"
|
||||
local local_port="$2"
|
||||
local socks_port="$3"
|
||||
@@ -1796,7 +1798,7 @@ start_udp() {
|
||||
;;
|
||||
v2ray)
|
||||
enable_mihomo=$(uci_get_by_type server_subscribe enable_mihomo "")
|
||||
if [ "$enable_mihomo" = "1" ] && has_mihomo_binary; then
|
||||
if [ "$(uci_get_by_name "$UDP_RELAY_SERVER" v2ray_protocol)" != "naive" ] && [ "$(uci_get_by_name "$UDP_RELAY_SERVER" v2ray_protocol)" != "shadowsocksr" ] && [ "$enable_mihomo" = "1" ] && has_mihomo_binary; then
|
||||
redir_udp=0
|
||||
ARG_UDP=""
|
||||
echolog "UDP TPROXY Relay:V2Ray/Xray 单节点由主 Mihomo 实例处理。"
|
||||
@@ -1809,7 +1811,7 @@ start_udp() {
|
||||
echolog "UDP TPROXY Relay:$($(first_type xray) version | head -1) Started!"
|
||||
else
|
||||
# Xray 不存在但 Mihomo 存在,回退到 Mihomo(当 enable_mihomo=0 时)
|
||||
if has_mihomo_binary; then
|
||||
if [ "$(uci_get_by_name "$UDP_RELAY_SERVER" v2ray_protocol)" != "naive" ] && [ "$(uci_get_by_name "$UDP_RELAY_SERVER" v2ray_protocol)" != "shadowsocksr" ] && has_mihomo_binary; then
|
||||
redir_udp=0
|
||||
ARG_UDP=""
|
||||
echolog "UDP TPROXY Relay:Xray 内核不存在,已回退到 Mihomo 内核启动。"
|
||||
@@ -2249,6 +2251,10 @@ get_udp_relay_mode() {
|
||||
v2ray)
|
||||
proto=$(uci_get_by_name "$node" v2ray_protocol)
|
||||
case "$proto" in
|
||||
naive)
|
||||
[ "$(uci_get_by_name "$node" naive_udp_over_tcp 0)" = "1" ] && echo "native" || echo "disabled"
|
||||
;;
|
||||
|
||||
http)
|
||||
echo "disabled"
|
||||
;;
|
||||
@@ -2736,6 +2742,16 @@ start_server() {
|
||||
fi
|
||||
echolog "Server:Socks5 Server$server_count Started!"
|
||||
;;
|
||||
naive)
|
||||
xray_bin="$(first_type xray)"
|
||||
[ -x "$xray_bin" ] || return 1
|
||||
config_file="$TMP_PATH/xray-server-$server_count.json"
|
||||
lua /usr/share/shadowsocksr/gen_naive_server.lua "$1" > "$config_file" || return 1
|
||||
"$xray_bin" run -test -c "$config_file" >> /var/ssrplus.log 2>&1 || return 1
|
||||
ln_start_bin "$xray_bin" xray-server-$server_count run -c "$config_file"
|
||||
echolog "Server: Xray NaiveProxy Server$server_count Started!"
|
||||
;;
|
||||
|
||||
vmess|vless|trojan|shadowsocks)
|
||||
# Xray 服务端支持
|
||||
port=$(uci_get_by_name "$1" server_port)
|
||||
|
||||
@@ -363,6 +363,14 @@ function outbound:handleIndex(index)
|
||||
trojan = function()
|
||||
trojan_shadowsocks()
|
||||
end,
|
||||
shadowsocksr = function()
|
||||
outbound_settings = {
|
||||
address = server.server, port = tonumber(server.server_port),
|
||||
password = server.password, method = server.ssr_method or "aes-128-cfb",
|
||||
protocol = server.ssr_protocol or "origin", protocolParam = server.protocol_param,
|
||||
obfs = server.ssr_obfs or "plain", obfsParam = server.obfs_param
|
||||
}
|
||||
end,
|
||||
shadowsocks = function()
|
||||
trojan_shadowsocks()
|
||||
end,
|
||||
@@ -375,6 +383,19 @@ function outbound:handleIndex(index)
|
||||
wireguard = function()
|
||||
wireguard()
|
||||
end,
|
||||
naive = function()
|
||||
outbound_settings = {
|
||||
address = server.server, port = tonumber(server.server_port),
|
||||
username = server.username, password = server.password,
|
||||
serverName = server.tls_host,
|
||||
certificateFile = server.naive_certificate_file,
|
||||
quic = server.naive_quic == "1",
|
||||
udpOverTcp = server.naive_udp_over_tcp == "1",
|
||||
insecureConcurrency = tonumber(server.naive_concurrency),
|
||||
quicCongestionControl = server.naive_quic_congestion,
|
||||
echConfigList = server.naive_ech_config
|
||||
}
|
||||
end,
|
||||
anytls = function()
|
||||
outbound_settings = {
|
||||
address = server.server,
|
||||
@@ -878,6 +899,14 @@ Xray.outbounds = {
|
||||
}
|
||||
}
|
||||
|
||||
-- Naive owns TLS/multiplexing; SSR owns obfuscation and uses native UDP.
|
||||
-- Preserve Xray socket marks and dialer chains for both.
|
||||
if server.v2ray_protocol == "naive" or server.v2ray_protocol == "shadowsocksr" then
|
||||
local ob = Xray.outbounds[1]
|
||||
ob.streamSettings = { network = "raw", sockopt = ob.streamSettings.sockopt }
|
||||
ob.mux = nil
|
||||
end
|
||||
|
||||
if xray_builtin_dns then
|
||||
table.insert(Xray.outbounds, {
|
||||
protocol = "dns",
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/lua
|
||||
local uci = require("luci.model.uci").cursor()
|
||||
local json = require "luci.jsonc"
|
||||
local s = assert(uci:get_all("shadowsocksr", arg[1]), "missing server section")
|
||||
assert(s.username and s.username ~= "" and s.password and s.password ~= "", "Naive credentials required")
|
||||
assert(s.tls_certificateFile and s.tls_keyFile, "Naive TLS certificate and key required")
|
||||
local alpn = {}
|
||||
local selected = s.naive_alpn or "h2"
|
||||
assert(selected == "h2" or selected == "h3" or selected == "h2,h3", "invalid Naive transport")
|
||||
for value in selected:gmatch("[^,]+") do alpn[#alpn + 1] = value end
|
||||
print(json.stringify({
|
||||
log = {loglevel = "warning"},
|
||||
inbounds = {{listen = "::", port = assert(tonumber(s.server_port)), protocol = "naive",
|
||||
settings = {users = {{username = s.username, password = s.password}}},
|
||||
streamSettings = {network = "naive", security = "tls", tlsSettings = {
|
||||
alpn = alpn, certificates = {{certificateFile = s.tls_certificateFile, keyFile = s.tls_keyFile}}
|
||||
}}
|
||||
}},
|
||||
outbounds = {{protocol = "freedom", settings = {}}}
|
||||
}, 1))
|
||||
Reference in new issue
Block a user