Use /etc/hosts when resolving names.

http://code.google.com/p/go/issues/detail?id=313

This conflics with Chris' patch at:
https://golang.org/cl/181063

But I believe this is more complete since it has a simple caching and proper tests.

R=cw, rsc
CC=golang-dev
https://golang.org/cl/183066
This commit is contained in:
Yves Junqueira 2010-01-15 13:43:14 -08:00 committed by Russ Cox
parent 01b4f2dd23
commit d6054fcd88
6 changed files with 148 additions and 2 deletions

View file

@ -278,6 +278,10 @@ func parseIPv4(s string) IP {
var p [IPv4len]byte
i := 0
for j := 0; j < IPv4len; j++ {
if i >= len(s) {
// Missing octets.
return nil
}
if j > 0 {
if s[i] != '.' {
return nil