From 3d669c3ec48d6747e63ab2f769482a80e84939e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E6=89=87=E6=BB=91=E7=BF=94=E7=BF=BC?= Date: Fri, 23 May 2025 14:07:50 +0000 Subject: [PATCH] BurstObservatory: Fix nil panic when pingConfig is missing --- infra/conf/observatory.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/infra/conf/observatory.go b/infra/conf/observatory.go index 1ae403db..62d6aaba 100644 --- a/infra/conf/observatory.go +++ b/infra/conf/observatory.go @@ -5,6 +5,7 @@ import ( "github.com/xtls/xray-core/app/observatory" "github.com/xtls/xray-core/app/observatory/burst" + "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/infra/conf/cfgcommon/duration" ) @@ -26,6 +27,9 @@ type BurstObservatoryConfig struct { } func (b BurstObservatoryConfig) Build() (proto.Message, error) { + if b.HealthCheck == nil { + return nil, errors.New("BurstObservatory requires a valid pingConfig") + } if result, err := b.HealthCheck.Build(); err == nil { return &burst.Config{SubjectSelector: b.SubjectSelector, PingConfig: result.(*burst.HealthPingConfig)}, nil } else {