mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-02 22:45:37 +00:00
net/dns: windows DNS experiments
This commit is contained in:
parent
6e584ffa33
commit
9a4423f788
39
net/dns/dns_windows_test.go
Normal file
39
net/dns/dns_windows_test.go
Normal file
@ -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)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user