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