2021-04-08 21:20:30 +00:00
|
|
|
package conf
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/golang/protobuf/proto"
|
2021-08-26 17:01:10 +00:00
|
|
|
|
2021-04-08 21:20:30 +00:00
|
|
|
"github.com/xtls/xray-core/app/observatory"
|
2021-10-26 05:00:31 +00:00
|
|
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/duration"
|
2021-04-08 21:20:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type ObservatoryConfig struct {
|
2021-08-26 17:01:10 +00:00
|
|
|
SubjectSelector []string `json:"subjectSelector"`
|
|
|
|
ProbeURL string `json:"probeURL"`
|
|
|
|
ProbeInterval duration.Duration `json:"probeInterval"`
|
|
|
|
EnableConcurrency bool `json:"enableConcurrency"`
|
2021-04-08 21:20:30 +00:00
|
|
|
}
|
|
|
|
|
2021-10-26 05:00:31 +00:00
|
|
|
func (o *ObservatoryConfig) Build() (proto.Message, error) {
|
2021-08-26 17:01:10 +00:00
|
|
|
return &observatory.Config{SubjectSelector: o.SubjectSelector, ProbeUrl: o.ProbeURL, ProbeInterval: int64(o.ProbeInterval), EnableConcurrency: o.EnableConcurrency}, nil
|
2021-04-08 21:20:30 +00:00
|
|
|
}
|