metrics.go 352 B

1234567891011121314151617181920
  1. package conf
  2. import (
  3. "github.com/xtls/xray-core/app/metrics"
  4. "github.com/xtls/xray-core/common/errors"
  5. )
  6. type MetricsConfig struct {
  7. Tag string `json:"tag"`
  8. }
  9. func (c *MetricsConfig) Build() (*metrics.Config, error) {
  10. if c.Tag == "" {
  11. return nil, errors.New("metrics tag can't be empty.")
  12. }
  13. return &metrics.Config{
  14. Tag: c.Tag,
  15. }, nil
  16. }