fix: add nil checks for TLS config in sing-box inbound builders

This commit is contained in:
xboard
2026-03-26 11:35:15 +08:00
parent 691ca93c82
commit 4b10271ce0
4 changed files with 72 additions and 33 deletions
+2 -2
View File
@@ -45,8 +45,8 @@ func buildConfig(kcfg config.KernelConfig, nc *panel.NodeConfig, users []panel.U
cfg := M{
"log": M{
"loglevel": xrayLogLevel(kcfg.LogLevel),
"error": "stdout",
"access": "stdout",
"error": "",
"access": "",
},
"stats": M{},
"policy": M{
+1 -1
View File
@@ -613,7 +613,7 @@ func (x *Xray) ensureGeoData(nc *panel.NodeConfig) {
// marshalConfig builds the xray JSON config and returns the raw bytes.
func marshalConfig(cfg config.KernelConfig, nc *panel.NodeConfig, users []panel.User, certFile, keyFile string) ([]byte, error) {
cfgMap := buildConfig(cfg, nc, users, certFile, keyFile)
data, err := json.Marshal(cfgMap)
data, err := json.MarshalIndent(cfgMap, "", " ")
if err != nil {
return nil, fmt.Errorf("marshal config: %w", err)
}