diff --git a/service/xboard/service.go b/service/xboard/service.go index 86f8dba6..a3aee1a0 100644 --- a/service/xboard/service.go +++ b/service/xboard/service.go @@ -331,40 +331,37 @@ func (s *Service) setupNode() error { var inboundOptions any switch protocol { case "vless": - vlessOptions := option.VLESSInboundOptions{ - ListenOptions: option.ListenOptions{ - Listen: &listenAddr, - ListenPort: uint16(inner.Port), - }, - InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{ - TLS: tlsOptions, - }, - } + vlessOptions := option.VLESSInboundOptions{} + vlessOptions.Listen = &listenAddr + vlessOptions.ListenPort = uint16(inner.Port) + vlessOptions.TLS = tlsOptions // Handle Reality - var streamSettings XStreamSettings - json.Unmarshal(inner.StreamSettings, &streamSettings) - reality := streamSettings.GetReality() - if streamSettings.Security == "reality" && reality != nil { - serverNames := reality.GetServerNames() - serverName := "" - if len(serverNames) > 0 { - serverName = serverNames[0] - } - vlessOptions.TLS = &option.InboundTLSOptions{ - Enabled: true, - ServerName: serverName, - Reality: &option.InboundRealityOptions{ - Enabled: true, - Handshake: option.InboundRealityHandshakeOptions{ - ServerOptions: option.ServerOptions{ - Server: reality.Dest, - ServerPort: 443, + if inner.StreamSettings != nil { + var streamSettings XStreamSettings + json.Unmarshal(inner.StreamSettings, &streamSettings) + reality := streamSettings.GetReality() + if streamSettings.Security == "reality" && reality != nil { + serverNames := reality.GetServerNames() + serverName := "" + if len(serverNames) > 0 { + serverName = serverNames[0] + } + vlessOptions.TLS = &option.InboundTLSOptions{ + Enabled: true, + ServerName: serverName, + Reality: &option.InboundRealityOptions{ + Enabled: true, + Handshake: option.InboundRealityHandshakeOptions{ + ServerOptions: option.ServerOptions{ + Server: reality.Dest, + ServerPort: 443, + }, }, + PrivateKey: reality.GetPrivateKey(), + ShortID: badoption.Listable[string](reality.GetShortIds()), }, - PrivateKey: reality.GetPrivateKey(), - ShortID: badoption.Listable[string](reality.GetShortIds()), - }, + } } } inboundOptions = &vlessOptions