mirror of
https://github.com/golang/go
synced 2024-11-21 21:24:45 -07:00
net: keep lookup IP stuff close
Also flattens import declaration. R=golang-dev, alex.brainman CC=golang-dev https://golang.org/cl/13373046
This commit is contained in:
parent
7c59c8bdee
commit
29de03adf3
@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import "time"
|
||||||
"time"
|
|
||||||
)
|
|
||||||
|
|
||||||
// protocols contains minimal mappings between internet protocol
|
// protocols contains minimal mappings between internet protocol
|
||||||
// names and numbers for platforms that don't have a complete list of
|
// names and numbers for platforms that don't have a complete list of
|
||||||
@ -21,6 +19,18 @@ var protocols = map[string]int{
|
|||||||
"ipv6-icmp": 58, "IPV6-ICMP": 58, "IPv6-ICMP": 58,
|
"ipv6-icmp": 58, "IPV6-ICMP": 58, "IPv6-ICMP": 58,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LookupHost looks up the given host using the local resolver.
|
||||||
|
// It returns an array of that host's addresses.
|
||||||
|
func LookupHost(host string) (addrs []string, err error) {
|
||||||
|
return lookupHost(host)
|
||||||
|
}
|
||||||
|
|
||||||
|
// LookupIP looks up host using the local resolver.
|
||||||
|
// It returns an array of that host's IPv4 and IPv6 addresses.
|
||||||
|
func LookupIP(host string) (addrs []IP, err error) {
|
||||||
|
return lookupIPMerge(host)
|
||||||
|
}
|
||||||
|
|
||||||
var lookupGroup singleflight
|
var lookupGroup singleflight
|
||||||
|
|
||||||
// lookupIPMerge wraps lookupIP, but makes sure that for any given
|
// lookupIPMerge wraps lookupIP, but makes sure that for any given
|
||||||
@ -42,12 +52,6 @@ func lookupIPMerge(host string) (addrs []IP, err error) {
|
|||||||
return addrs, nil
|
return addrs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// LookupHost looks up the given host using the local resolver.
|
|
||||||
// It returns an array of that host's addresses.
|
|
||||||
func LookupHost(host string) (addrs []string, err error) {
|
|
||||||
return lookupHost(host)
|
|
||||||
}
|
|
||||||
|
|
||||||
func lookupIPDeadline(host string, deadline time.Time) (addrs []IP, err error) {
|
func lookupIPDeadline(host string, deadline time.Time) (addrs []IP, err error) {
|
||||||
if deadline.IsZero() {
|
if deadline.IsZero() {
|
||||||
return lookupIPMerge(host)
|
return lookupIPMerge(host)
|
||||||
@ -85,12 +89,6 @@ func lookupIPDeadline(host string, deadline time.Time) (addrs []IP, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// LookupIP looks up host using the local resolver.
|
|
||||||
// It returns an array of that host's IPv4 and IPv6 addresses.
|
|
||||||
func LookupIP(host string) (addrs []IP, err error) {
|
|
||||||
return lookupIPMerge(host)
|
|
||||||
}
|
|
||||||
|
|
||||||
// LookupPort looks up the port for the given network and service.
|
// LookupPort looks up the port for the given network and service.
|
||||||
func LookupPort(network, service string) (port int, err error) {
|
func LookupPort(network, service string) (port int, err error) {
|
||||||
return lookupPort(network, service)
|
return lookupPort(network, service)
|
||||||
|
Loading…
Reference in New Issue
Block a user