diff --git a/service/xboard/service.go b/service/xboard/service.go index b0b53ddd..e2df89fe 100644 --- a/service/xboard/service.go +++ b/service/xboard/service.go @@ -129,8 +129,7 @@ type XInnerConfig struct { Port int `json:"port"` ServerPort int `json:"server_port"` Protocol string `json:"protocol"` - Settings json.RawMessage `json:"settings"` - StreamSettings json.RawMessage `json:"streamSettings"` + NodeType string `json:"node_type"` Cipher string `json:"cipher"` ServerKey string `json:"server_key"` TLS int `json:"tls"` @@ -138,8 +137,11 @@ type XInnerConfig struct { TLSSettings *XTLSSettings `json:"tls_settings"` TLSSettings_ *XTLSSettings `json:"tlsSettings"` Network string `json:"network"` - NetworkSettings json.RawMessage `json:"network_settings"` + NetworkSettings json.RawMessage `json:"network_settings"` NetworkSettings_ json.RawMessage `json:"networkSettings"` + StreamSettings json.RawMessage `json:"streamSettings"` + UpMbps int `json:"up_mbps"` + DownMbps int `json:"down_mbps"` } type HttpNetworkConfig struct { @@ -451,11 +453,16 @@ func (s *Service) setupNode() error { // Resolve protocol protocol := inner.Protocol if protocol == "" { - protocol = config.NodeType + protocol = inner.NodeType } 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 == "" { s.logger.Error("Xboard setup error: could not identify protocol. Please check debug logs for raw JSON.") return fmt.Errorf("unsupported protocol: empty")