修复UDP转发消失的问题(强制重写)

This commit is contained in:
CN-JS-HuiBai
2026-04-17 19:57:41 +08:00
parent 35631da799
commit 64e7d4439a
3 changed files with 21 additions and 1 deletions

View File

@@ -344,6 +344,14 @@ cat > "$CONFIG_ROUTE_FILE" <<EOF
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"network": [
"udp",
"tcp"
],
"action": "route",
"outbound": "direct"
}
],
"auto_detect_interface": true

View File

@@ -395,6 +395,14 @@ write_default_route_config() {
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"network": [
"udp",
"tcp"
],
"action": "route",
"outbound": "direct"
}
],
"auto_detect_interface": true

View File

@@ -1215,6 +1215,9 @@ func (s *Service) setupNode() error {
// ── Resolve network transport settings (V2bX style) ──
networkType := inner.Network
if networkType == "" || networkType == "tcp" || networkType == "udp" {
networkType = "tcp,udp"
}
networkSettings := inner.NetworkSettings
if len(networkSettings) == 0 {
networkSettings = inner.NetworkSettings_
@@ -1230,7 +1233,7 @@ func (s *Service) setupNode() error {
", inner_server_port=", inner.ServerPort,
", config_port=", config.Port,
", config_server_port=", config.ServerPort,
", network=", networkType,
", network=", networkType, " (forced TCP/UDP)",
", tls=", securityType,
", multiplex=", multiplex != nil,
)
@@ -1298,6 +1301,7 @@ func (s *Service) setupNode() error {
// The panel provides it already in the correct format (base64 for 2022)
ssOptions := &option.ShadowsocksInboundOptions{
ListenOptions: listen,
Network: "tcp\nudp",
Method: method,
Multiplex: multiplex,
}