This commit is contained in:
RPRX 2020-11-25 19:01:53 +08:00
parent 47d23e9972
commit c7f7c08ead
711 changed files with 82154 additions and 2 deletions

26
infra/conf/dns_proxy.go Normal file
View file

@ -0,0 +1,26 @@
package conf
import (
"github.com/golang/protobuf/proto"
"github.com/xtls/xray-core/v1/common/net"
"github.com/xtls/xray-core/v1/proxy/dns"
)
type DNSOutboundConfig struct {
Network Network `json:"network"`
Address *Address `json:"address"`
Port uint16 `json:"port"`
}
func (c *DNSOutboundConfig) Build() (proto.Message, error) {
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
}