Xray-core/infra/conf/dns_proxy_test.go

35 lines
638 B
Go
Raw Normal View History

2020-11-25 11:01:53 +00:00
package conf_test
import (
"testing"
2020-12-04 01:36:16 +00:00
"github.com/xtls/xray-core/common/net"
. "github.com/xtls/xray-core/infra/conf"
"github.com/xtls/xray-core/proxy/dns"
2020-11-25 11:01:53 +00:00
)
func TestDnsProxyConfig(t *testing.T) {
creator := func() Buildable {
return new(DNSOutboundConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{
"address": "8.8.8.8",
"port": 53,
"network": "tcp"
}`,
Parser: loadJSON(creator),
Output: &dns.Config{
Server: &net.Endpoint{
Network: net.Network_TCP,
Address: net.NewIPOrDomain(net.IPAddress([]byte{8, 8, 8, 8})),
Port: 53,
},
2023-06-19 00:51:03 +00:00
Non_IPQuery: "drop",
2020-11-25 11:01:53 +00:00
},
},
})
}