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:
parent
84c8e24a6c
commit
462bc3cfba
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/xtls/xray-core/app/observatory"
|
"github.com/xtls/xray-core/app/observatory"
|
||||||
"github.com/xtls/xray-core/app/observatory/burst"
|
"github.com/xtls/xray-core/app/observatory/burst"
|
||||||
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/infra/conf/cfgcommon/duration"
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/duration"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,6 +27,9 @@ type BurstObservatoryConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b BurstObservatoryConfig) Build() (proto.Message, error) {
|
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 {
|
if result, err := b.HealthCheck.Build(); err == nil {
|
||||||
return &burst.Config{SubjectSelector: b.SubjectSelector, PingConfig: result.(*burst.HealthPingConfig)}, nil
|
return &burst.Config{SubjectSelector: b.SubjectSelector, PingConfig: result.(*burst.HealthPingConfig)}, nil
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user