mirror of
https://github.com/golang/go
synced 2024-09-29 20:24:34 -06:00
useTCP: OpenBSD & FreeBSD support
This commit is contained in:
parent
971eb363f6
commit
70bc00fe41
@ -124,11 +124,13 @@ func dnsReadConfig(filename string) *dnsConfig {
|
||||
// This option disables the behavior and makes glibc
|
||||
// perform the IPv6 and IPv4 requests sequentially."
|
||||
conf.singleRequest = true
|
||||
case s == "use-vc":
|
||||
// Linux glibc option:
|
||||
case s == "use-vc" || s == "usevc" || s == "tcp":
|
||||
// Linux (use-vc), FreeBSD (usevc) and OpenBSD (tcp) option:
|
||||
// http://man7.org/linux/man-pages/man5/resolv.conf.5.html
|
||||
// "Sets RES_USEVC in _res.options.
|
||||
// This option forces the use of TCP for DNS resolutions."
|
||||
// https://www.freebsd.org/cgi/man.cgi?query=resolv.conf&sektion=5&manpath=freebsd-release-ports
|
||||
// https://man.openbsd.org/resolv.conf.5
|
||||
conf.useTCP = true
|
||||
default:
|
||||
conf.unknownOpt = true
|
||||
|
@ -125,7 +125,29 @@ var dnsReadConfigTests = []struct {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "testdata/use-vc-resolv.conf",
|
||||
name: "testdata/linux-use-vc-resolv.conf",
|
||||
want: &dnsConfig{
|
||||
servers: defaultNS,
|
||||
ndots: 1,
|
||||
useTCP: true,
|
||||
timeout: 5 * time.Second,
|
||||
attempts: 2,
|
||||
search: []string{"domain.local."},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "testdata/freebsd-usevc-resolv.conf",
|
||||
want: &dnsConfig{
|
||||
servers: defaultNS,
|
||||
ndots: 1,
|
||||
useTCP: true,
|
||||
timeout: 5 * time.Second,
|
||||
attempts: 2,
|
||||
search: []string{"domain.local."},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "testdata/openbsd-tcp-resolv.conf",
|
||||
want: &dnsConfig{
|
||||
servers: defaultNS,
|
||||
ndots: 1,
|
||||
|
1
src/net/testdata/freebsd-usevc-resolv.conf
vendored
Normal file
1
src/net/testdata/freebsd-usevc-resolv.conf
vendored
Normal file
@ -0,0 +1 @@
|
||||
options usevc
|
1
src/net/testdata/openbsd-tcp-resolv.conf
vendored
Normal file
1
src/net/testdata/openbsd-tcp-resolv.conf
vendored
Normal file
@ -0,0 +1 @@
|
||||
options tcp
|
Loading…
Reference in New Issue
Block a user