dns_proxy_test.go 693 B

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