2016-10-17 08:35:13 -04:00
|
|
|
package conf
|
|
|
|
|
|
|
|
import (
|
|
|
|
"v2ray.com/core/common/loader"
|
|
|
|
"v2ray.com/core/proxy/dokodemo"
|
|
|
|
)
|
|
|
|
|
|
|
|
type DokodemoConfig struct {
|
|
|
|
Host *Address `json:"address"`
|
|
|
|
PortValue uint16 `json:"port"`
|
|
|
|
NetworkList *NetworkList `json:"network"`
|
|
|
|
TimeoutValue uint32 `json:"timeout"`
|
|
|
|
Redirect bool `json:"followRedirect"`
|
|
|
|
}
|
|
|
|
|
2016-11-27 15:39:09 -05:00
|
|
|
func (v *DokodemoConfig) Build() (*loader.TypedSettings, error) {
|
2016-10-17 08:35:13 -04:00
|
|
|
config := new(dokodemo.Config)
|
2016-11-27 15:39:09 -05:00
|
|
|
if v.Host != nil {
|
|
|
|
config.Address = v.Host.Build()
|
2016-10-17 08:35:13 -04:00
|
|
|
}
|
2016-11-27 15:39:09 -05:00
|
|
|
config.Port = uint32(v.PortValue)
|
|
|
|
config.NetworkList = v.NetworkList.Build()
|
|
|
|
config.Timeout = v.TimeoutValue
|
|
|
|
config.FollowRedirect = v.Redirect
|
2016-10-17 08:35:13 -04:00
|
|
|
return loader.NewTypedSettings(config), nil
|
|
|
|
}
|