dns_proxy_test.go 613 B

123456789101112131415161718192021222324252627282930313233
  1. package conf_test
  2. import (
  3. "testing"
  4. "github.com/xtls/xray-core/common/net"
  5. . "github.com/xtls/xray-core/infra/conf"
  6. "github.com/xtls/xray-core/proxy/dns"
  7. )
  8. func TestDnsProxyConfig(t *testing.T) {
  9. creator := func() Buildable {
  10. return new(DNSOutboundConfig)
  11. }
  12. runMultiTestCase(t, []TestCase{
  13. {
  14. Input: `{
  15. "address": "8.8.8.8",
  16. "port": 53,
  17. "network": "tcp"
  18. }`,
  19. Parser: loadJSON(creator),
  20. Output: &dns.Config{
  21. Server: &net.Endpoint{
  22. Network: net.Network_TCP,
  23. Address: net.NewIPOrDomain(net.IPAddress([]byte{8, 8, 8, 8})),
  24. Port: 53,
  25. },
  26. },
  27. },
  28. })
  29. }