diff options
| author | Brad Fitzpatrick <brad@danga.com> | 2021-11-30 11:56:34 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <brad@danga.com> | 2021-11-30 11:56:34 -0800 |
| commit | 9a4423f7886dd50c64b9fbe8670242737dcf497e (patch) | |
| tree | 3ea3db863a54c471a0afea588032aa8b01459c05 /net | |
| parent | 6e584ffa33a8c2b4c11aeddf75cbbe79f4cbb523 (diff) | |
| download | tailscale-bradfitz/windns.tar.xz tailscale-bradfitz/windns.zip | |
net/dns: windows DNS experimentsbradfitz/windns
Diffstat (limited to 'net')
| -rw-r--r-- | net/dns/dns_windows_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/net/dns/dns_windows_test.go b/net/dns/dns_windows_test.go new file mode 100644 index 000000000..47ce8b0d9 --- /dev/null +++ b/net/dns/dns_windows_test.go @@ -0,0 +1,39 @@ +// Copyright (c) 2021 Tailscale Inc & AUTHORS All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package dns + +import ( + "testing" + + "golang.org/x/sys/windows" +) + +func TestWindowsDNSQuery(t *testing.T) { + /* + DNS_TYPE_A = 0x0001 + DNS_TYPE_AAAA = 0x001c + DNS_TYPE_SRV = 0x0021 + DNS_TYPE_TEXT = 0x0010 + */ + var options uint32 = 0 + var qtype uint16 = windows.DNS_TYPE_AAAA + var qrs *windows.DNSRecord + st := windows.DnsQuery("google.com", qtype, options, nil, &qrs, nil) + t.Logf("status = %v", st) + if qrs != nil { + const ( + DnsFreeFlat = 0 + DnsFreeRecordList = 1 + DnsFreeParsedMessageFields = 2 + ) + defer windows.DnsRecordListFree(qrs, DnsFreeRecordList) + } + t.Logf("qrs = %p", qrs) + for rec := qrs; rec != nil; rec = rec.Next { + t.Logf("rec: %+v", rec) + name := windows.UTF16PtrToString(rec.Name) + t.Logf(" name = %q", name) + } +} |
