1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-08 19:28:21 -05:00
v2fly/tools/conf/freedom.go

25 lines
612 B
Go
Raw Normal View History

2016-10-17 08:35:13 -04:00
package conf
import (
"strings"
"v2ray.com/core/common/loader"
"v2ray.com/core/proxy/freedom"
)
type FreedomConfig struct {
DomainStrategy string `json:"domainStrategy"`
Timeout uint32 `json:"timeout"`
}
func (this *FreedomConfig) Build() (*loader.TypedSettings, error) {
config := new(freedom.Config)
config.DomainStrategy = freedom.Config_AS_IS
domainStrategy := strings.ToLower(this.DomainStrategy)
if domainStrategy == "useip" || domainStrategy == "use_ip" {
config.DomainStrategy = freedom.Config_USE_IP
}
config.Timeout = this.Timeout
return loader.NewTypedSettings(config), nil
}