Dont append the default port to the nameservers

This commit is contained in:
Miek Gieben 2011-12-09 16:13:59 +01:00
parent 17d3f12d31
commit d5c309e8d8
1 changed files with 3 additions and 4 deletions

View File

@ -25,9 +25,8 @@ type ClientConfig struct {
Attempts int // lost packets before giving up on server Attempts int // lost packets before giving up on server
} }
// See resolv.conf(5) on a Linux machine. // ClientConfigFromFile parses a resolv.conf(5) like file and returns
// Parse a /etc/resolv.conf like file and return a filled out ClientConfig. Note // a *ClientConfig.
// that all nameservers will have the default port number appended (:53)
func ClientConfigFromFile(conf string) (*ClientConfig, error) { func ClientConfigFromFile(conf string) (*ClientConfig, error) {
file, err := os.Open(conf) file, err := os.Open(conf)
defer file.Close() defer file.Close()
@ -62,7 +61,7 @@ func ClientConfigFromFile(conf string) (*ClientConfig, error) {
fallthrough fallthrough
case 4: case 4:
a = a[0 : n+1] a = a[0 : n+1]
a[n] = name + ":53" a[n] = name
c.Servers = a c.Servers = a
} }
} }