github.com/xmplusdev/xmcore@v1.8.11-0.20240412132628-5518b55526af/infra/conf/dns_proxy_test.go (about)

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