Source file src/pkg/net/doc.go
1 // Copyright 2012 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.
4
5 package net
6
7 // LookupHost looks up the given host using the local resolver.
8 // It returns an array of that host's addresses.
9 func LookupHost(host string) (addrs []string, err error) {
10 return lookupHost(host)
11 }
12
13 // LookupIP looks up host using the local resolver.
14 // It returns an array of that host's IPv4 and IPv6 addresses.
15 func LookupIP(host string) (addrs []IP, err error) {
16 return lookupIP(host)
17 }
18
19 // LookupPort looks up the port for the given network and service.
20 func LookupPort(network, service string) (port int, err error) {
21 return lookupPort(network, service)
22 }
23
24 // LookupCNAME returns the canonical DNS host for the given name.
25 // Callers that do not care about the canonical name can call
26 // LookupHost or LookupIP directly; both take care of resolving
27 // the canonical name as part of the lookup.
28 func LookupCNAME(name string) (cname string, err error) {
29 return lookupCNAME(name)
30 }
31
32 // LookupSRV tries to resolve an SRV query of the given service,
33 // protocol, and domain name. The proto is "tcp" or "udp".
34 // The returned records are sorted by priority and randomized
35 // by weight within a priority.
36 //
37 // LookupSRV constructs the DNS name to look up following RFC 2782.
38 // That is, it looks up _service._proto.name. To accommodate services
39 // publishing SRV records under non-standard names, if both service
40 // and proto are empty strings, LookupSRV looks up name directly.
41 func LookupSRV(service, proto, name string) (cname string, addrs []*SRV, err error) {
42 return lookupSRV(service, proto, name)
43 }
44
45 // LookupMX returns the DNS MX records for the given domain name sorted by preference.
46 func LookupMX(name string) (mx []*MX, err error) {
47 return lookupMX(name)
48 }
49
50 // LookupTXT returns the DNS TXT records for the given domain name.
51 func LookupTXT(name string) (txt []string, err error) {
52 return lookupTXT(name)
53 }
54
55 // LookupAddr performs a reverse lookup for the given address, returning a list
56 // of names mapping to that address.
57 func LookupAddr(addr string) (name []string, err error) {
58 return lookupAddr(addr)
59 }