2013-08-13 10:44:12 -06:00
|
|
|
// 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.
|
|
|
|
|
2014-04-30 08:26:07 -06:00
|
|
|
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
2013-08-13 14:44:57 -06:00
|
|
|
|
2013-08-13 10:44:12 -06:00
|
|
|
package net
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestTCPLookup(t *testing.T) {
|
|
|
|
if testing.Short() || !*testExternal {
|
|
|
|
t.Skip("skipping test to avoid external network")
|
|
|
|
}
|
|
|
|
c, err := Dial("tcp", "8.8.8.8:53")
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Dial failed: %v", err)
|
|
|
|
}
|
2013-08-14 14:07:35 -06:00
|
|
|
defer c.Close()
|
2013-08-13 10:44:12 -06:00
|
|
|
cfg := &dnsConfig{timeout: 10, attempts: 3}
|
|
|
|
_, err = exchange(cfg, c, "com.", dnsTypeALL)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("exchange failed: %v", err)
|
|
|
|
}
|
|
|
|
}
|