mirror of
https://github.com/golang/go.git
synced 2025-11-09 21:21:03 +00:00
net: append ":53" to DNS servers when reading resolv.conf
Avoids generating some redundant garbage from re-concatenating the same string for every DNS query. benchmark old allocs new allocs delta BenchmarkGoLookupIP-32 156 154 -1.28% BenchmarkGoLookupIPNoSuchHost-32 456 446 -2.19% BenchmarkGoLookupIPWithBrokenNameServer-32 577 564 -2.25% benchmark old bytes new bytes delta BenchmarkGoLookupIP-32 10873 10824 -0.45% BenchmarkGoLookupIPNoSuchHost-32 43303 43140 -0.38% BenchmarkGoLookupIPWithBrokenNameServer-32 46824 46616 -0.44% Update #15473. Change-Id: I3b0173dfedf31bd08eaea1069968b416850864a1 Reviewed-on: https://go-review.googlesource.com/22556 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
2cc27a7de9
commit
4d9bda51ff
4 changed files with 10 additions and 11 deletions
|
|
@ -21,7 +21,7 @@ var dnsReadConfigTests = []struct {
|
|||
{
|
||||
name: "testdata/resolv.conf",
|
||||
want: &dnsConfig{
|
||||
servers: []string{"8.8.8.8", "2001:4860:4860::8888", "fe80::1%lo0"},
|
||||
servers: []string{"8.8.8.8:53", "[2001:4860:4860::8888]:53", "[fe80::1%lo0]:53"},
|
||||
search: []string{"localdomain"},
|
||||
ndots: 5,
|
||||
timeout: 10 * time.Second,
|
||||
|
|
@ -33,7 +33,7 @@ var dnsReadConfigTests = []struct {
|
|||
{
|
||||
name: "testdata/domain-resolv.conf",
|
||||
want: &dnsConfig{
|
||||
servers: []string{"8.8.8.8"},
|
||||
servers: []string{"8.8.8.8:53"},
|
||||
search: []string{"localdomain"},
|
||||
ndots: 1,
|
||||
timeout: 5 * time.Second,
|
||||
|
|
@ -43,7 +43,7 @@ var dnsReadConfigTests = []struct {
|
|||
{
|
||||
name: "testdata/search-resolv.conf",
|
||||
want: &dnsConfig{
|
||||
servers: []string{"8.8.8.8"},
|
||||
servers: []string{"8.8.8.8:53"},
|
||||
search: []string{"test", "invalid"},
|
||||
ndots: 1,
|
||||
timeout: 5 * time.Second,
|
||||
|
|
@ -67,7 +67,7 @@ var dnsReadConfigTests = []struct {
|
|||
timeout: 5 * time.Second,
|
||||
attempts: 2,
|
||||
lookup: []string{"file", "bind"},
|
||||
servers: []string{"169.254.169.254", "10.240.0.1"},
|
||||
servers: []string{"169.254.169.254:53", "10.240.0.1:53"},
|
||||
search: []string{"c.symbolic-datum-552.internal."},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue