0
mirror of https://github.com/XTLS/Xray-core.git synced 2025-06-08 01:43:35 +03:00

BurstObservatory: Fix nil panic when pingConfig is missing (#4757)

Fixes https://github.com/XTLS/Xray-core/issues/4756
This commit is contained in:
风扇滑翔翼 2025-06-04 20:37:43 +08:00 committed by GitHub
parent 84c8e24a6c
commit 462bc3cfba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 {