1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
11 // LookupHost looks up the given host using the local resolver.
12 // It returns an array of that host's addresses.
13 func LookupHost(host string) (addrs []string, err os.Error) {
14 addrs, err, ok := cgoLookupHost(host)
16 addrs, err = goLookupHost(host)
21 // LookupIP looks up host using the local resolver.
22 // It returns an array of that host's IPv4 and IPv6 addresses.
23 func LookupIP(host string) (addrs []IP, err os.Error) {
24 addrs, err, ok := cgoLookupIP(host)
26 addrs, err = goLookupIP(host)
31 // LookupPort looks up the port for the given network and service.
32 func LookupPort(network, service string) (port int, err os.Error) {
33 port, err, ok := cgoLookupPort(network, service)
35 port, err = goLookupPort(network, service)
40 // LookupCNAME returns the canonical DNS host for the given name.
41 // Callers that do not care about the canonical name can call
42 // LookupHost or LookupIP directly; both take care of resolving
43 // the canonical name as part of the lookup.
44 func LookupCNAME(name string) (cname string, err os.Error) {
45 cname, err, ok := cgoLookupCNAME(name)
47 cname, err = goLookupCNAME(name)