github.com/xraypb/Xray-core@v1.8.1/infra/conf/dns_proxy.go (about) 1 package conf 2 3 import ( 4 "github.com/golang/protobuf/proto" 5 "github.com/xraypb/Xray-core/common/net" 6 "github.com/xraypb/Xray-core/proxy/dns" 7 ) 8 9 type DNSOutboundConfig struct { 10 Network Network `json:"network"` 11 Address *Address `json:"address"` 12 Port uint16 `json:"port"` 13 UserLevel uint32 `json:"userLevel"` 14 } 15 16 func (c *DNSOutboundConfig) Build() (proto.Message, error) { 17 config := &dns.Config{ 18 Server: &net.Endpoint{ 19 Network: c.Network.Build(), 20 Port: uint32(c.Port), 21 }, 22 UserLevel: c.UserLevel, 23 } 24 if c.Address != nil { 25 config.Server.Address = c.Address.Build() 26 } 27 return config, nil 28 }