github.com/Asutorufa/yuhaiin@v0.3.6-0.20240502055049-7984da7023a0/pkg/net/dns/tcp_test.go (about) 1 package dns 2 3 import ( 4 "context" 5 "net/netip" 6 "testing" 7 8 "github.com/Asutorufa/yuhaiin/pkg/protos/config/dns" 9 "github.com/Asutorufa/yuhaiin/pkg/utils/assert" 10 ) 11 12 func TestTCP(t *testing.T) { 13 subnet, _ := netip.ParsePrefix("1.1.1.1/32") 14 15 configMap := map[string]Config{ 16 "114": { 17 Type: dns.Type_tcp, 18 Host: "114.114.114.114", 19 Subnet: subnet, 20 }, 21 } 22 23 dns, err := New(configMap["114"]) 24 assert.NoError(t, err) 25 26 t.Log(dns.LookupIP(context.TODO(), "baidu.com")) 27 t.Log(dns.LookupIP(context.TODO(), "google.com")) 28 }