mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-16 09:26:21 -05:00
25 lines
600 B
Go
25 lines
600 B
Go
package conf
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"v2ray.com/core/common/serial"
|
|
"v2ray.com/core/proxy/freedom"
|
|
)
|
|
|
|
type FreedomConfig struct {
|
|
DomainStrategy string `json:"domainStrategy"`
|
|
Timeout uint32 `json:"timeout"`
|
|
}
|
|
|
|
func (v *FreedomConfig) Build() (*serial.TypedMessage, error) {
|
|
config := new(freedom.Config)
|
|
config.DomainStrategy = freedom.Config_AS_IS
|
|
domainStrategy := strings.ToLower(v.DomainStrategy)
|
|
if domainStrategy == "useip" || domainStrategy == "use_ip" {
|
|
config.DomainStrategy = freedom.Config_USE_IP
|
|
}
|
|
config.Timeout = v.Timeout
|
|
return serial.ToTypedMessage(config), nil
|
|
}
|