dns_proxy_test.go 794 B

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