mirror of
https://github.com/golang/go.git
synced 2025-11-01 01:00:56 +00:00
net: implement DNS TCP fallback query if UDP response is truncated
Fixes #5686. R=golang-dev, bradfitz, mikioh.mikioh CC=golang-dev https://golang.org/cl/12458043
This commit is contained in:
parent
c18dc11ef2
commit
0a3cb7ece3
2 changed files with 67 additions and 4 deletions
29
src/pkg/net/dnsclient_unix_test.go
Normal file
29
src/pkg/net/dnsclient_unix_test.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2013 The Go 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 net
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTCPLookup(t *testing.T) {
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "plan9" {
|
||||
t.Skip("skipping unix dns test")
|
||||
}
|
||||
if testing.Short() || !*testExternal {
|
||||
t.Skip("skipping test to avoid external network")
|
||||
}
|
||||
c, err := Dial("tcp", "8.8.8.8:53")
|
||||
defer c.Close()
|
||||
if err != nil {
|
||||
t.Fatalf("Dial failed: %v", err)
|
||||
}
|
||||
cfg := &dnsConfig{timeout: 10, attempts: 3}
|
||||
_, err = exchange(cfg, c, "com.", dnsTypeALL)
|
||||
if err != nil {
|
||||
t.Fatalf("exchange failed: %v", err)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue