mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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:
parent
01b4f2dd23
commit
d6054fcd88
6 changed files with 148 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue