v2ray-core/infra/conf/dns_proxy.go

27 lines
525 B
Go
Raw Normal View History

2019-02-10 18:04:11 +00:00
package conf
import (
"github.com/golang/protobuf/proto"
2019-02-12 21:34:43 +00:00
"v2ray.com/core/common/net"
2019-02-10 18:04:11 +00:00
"v2ray.com/core/proxy/dns"
)
2019-02-12 21:34:43 +00:00
type DnsOutboundConfig struct {
Network Network `json:"network"`
Address *Address `json:"address"`
Port uint16 `json:"port"`
2019-02-12 21:34:43 +00:00
}
2019-02-10 18:04:11 +00:00
func (c *DnsOutboundConfig) Build() (proto.Message, error) {
2019-02-12 21:34:43 +00:00
config := &dns.Config{
Server: &net.Endpoint{
Network: c.Network.Build(),
Port: uint32(c.Port),
},
}
if c.Address != nil {
config.Server.Address = c.Address.Build()
}
return config, nil
2019-02-10 18:04:11 +00:00
}