version.go 522 B

12345678910111213141516171819202122
  1. package conf
  2. import (
  3. "github.com/xtls/xray-core/app/version"
  4. "github.com/xtls/xray-core/core"
  5. "strconv"
  6. )
  7. type VersionConfig struct {
  8. MinVersion string `json:"min"`
  9. MaxVersion string `json:"max"`
  10. }
  11. func (c *VersionConfig) Build() (*version.Config, error) {
  12. coreVersion := strconv.Itoa(int(core.Version_x)) + "." + strconv.Itoa(int(core.Version_y)) + "." + strconv.Itoa(int(core.Version_z))
  13. return &version.Config{
  14. CoreVersion: coreVersion,
  15. MinVersion: c.MinVersion,
  16. MaxVersion: c.MaxVersion,
  17. }, nil
  18. }