dokodemo.go 718 B

1234567891011121314151617181920212223242526
  1. package conf
  2. import (
  3. "v2ray.com/core/common/loader"
  4. "v2ray.com/core/proxy/dokodemo"
  5. )
  6. type DokodemoConfig struct {
  7. Host *Address `json:"address"`
  8. PortValue uint16 `json:"port"`
  9. NetworkList *NetworkList `json:"network"`
  10. TimeoutValue uint32 `json:"timeout"`
  11. Redirect bool `json:"followRedirect"`
  12. }
  13. func (this *DokodemoConfig) Build() (*loader.TypedSettings, error) {
  14. config := new(dokodemo.Config)
  15. if this.Host != nil {
  16. config.Address = this.Host.Build()
  17. }
  18. config.Port = uint32(this.PortValue)
  19. config.NetworkList = this.NetworkList.Build()
  20. config.Timeout = this.TimeoutValue
  21. config.FollowRedirect = this.Redirect
  22. return loader.NewTypedSettings(config), nil
  23. }