这一套逻辑已经完美对齐 V2bX!

This commit is contained in:
CN-JS-HuiBai
2026-04-15 01:38:41 +08:00
parent f8bffcd4a4
commit f6c02cc118

View File

@@ -129,8 +129,7 @@ type XInnerConfig struct {
Port int `json:"port"` Port int `json:"port"`
ServerPort int `json:"server_port"` ServerPort int `json:"server_port"`
Protocol string `json:"protocol"` Protocol string `json:"protocol"`
Settings json.RawMessage `json:"settings"` NodeType string `json:"node_type"`
StreamSettings json.RawMessage `json:"streamSettings"`
Cipher string `json:"cipher"` Cipher string `json:"cipher"`
ServerKey string `json:"server_key"` ServerKey string `json:"server_key"`
TLS int `json:"tls"` TLS int `json:"tls"`
@@ -138,8 +137,11 @@ type XInnerConfig struct {
TLSSettings *XTLSSettings `json:"tls_settings"` TLSSettings *XTLSSettings `json:"tls_settings"`
TLSSettings_ *XTLSSettings `json:"tlsSettings"` TLSSettings_ *XTLSSettings `json:"tlsSettings"`
Network string `json:"network"` Network string `json:"network"`
NetworkSettings json.RawMessage `json:"network_settings"` NetworkSettings json.RawMessage `json:"network_settings"`
NetworkSettings_ json.RawMessage `json:"networkSettings"` NetworkSettings_ json.RawMessage `json:"networkSettings"`
StreamSettings json.RawMessage `json:"streamSettings"`
UpMbps int `json:"up_mbps"`
DownMbps int `json:"down_mbps"`
} }
type HttpNetworkConfig struct { type HttpNetworkConfig struct {
@@ -451,11 +453,16 @@ func (s *Service) setupNode() error {
// Resolve protocol // Resolve protocol
protocol := inner.Protocol protocol := inner.Protocol
if protocol == "" { if protocol == "" {
protocol = config.NodeType protocol = inner.NodeType
} }
if protocol == "" { if protocol == "" {
protocol = config.NodeType_ protocol = config.NodeType
} }
if protocol == "" && inner.Cipher != "" {
// Fallback for shadowsocks where protocol might be missing but cipher is present
protocol = "shadowsocks"
}
if protocol == "" { if protocol == "" {
s.logger.Error("Xboard setup error: could not identify protocol. Please check debug logs for raw JSON.") s.logger.Error("Xboard setup error: could not identify protocol. Please check debug logs for raw JSON.")
return fmt.Errorf("unsupported protocol: empty") return fmt.Errorf("unsupported protocol: empty")