github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/infra/conf/v4/dns_proxy_test.go (about)

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