Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(458)

Delta Between Two Patch Sets: src/pkg/net/lookup.go

Issue 4244055: code review 4244055: net: drop laddr from Dial, cname from LookupHost; new f... (Closed)
Left Patch Set: diff -r 5ccb9b6f8cd1 https://go.googlecode.com/hg Created 13 years ago
Right Patch Set: diff -r 8b9c0b903333 https://go.googlecode.com/hg/ Created 13 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/net/ipsock.go ('k') | src/pkg/net/net_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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.
4
1 package net 5 package net
2 6
3 import ( 7 import (
4 "os" 8 "os"
5 ) 9 )
6 10
7 // LookupHost looks for name using the local resolver. 11 // LookupHost looks up the given host using the local resolver.
8 // It returns an array of that host's addresses. 12 // It returns an array of that host's addresses.
9 func LookupHost(name string) (addrs []string, err os.Error) { 13 func LookupHost(host string) (addrs []string, err os.Error) {
10 » addrs, err, ok := cgoLookupHost(name) 14 » addrs, err, ok := cgoLookupHost(host)
11 if !ok { 15 if !ok {
12 » » addrs, err = goLookupHost(name) 16 » » addrs, err = goLookupHost(host)
17 » }
18 » return
19 }
20
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)
25 » if !ok {
26 » » addrs, err = goLookupIP(host)
13 } 27 }
14 return 28 return
15 } 29 }
16 30
17 // LookupPort looks up the port for the given network and service. 31 // LookupPort looks up the port for the given network and service.
18 func LookupPort(network, service string) (port int, err os.Error) { 32 func LookupPort(network, service string) (port int, err os.Error) {
19 port, err, ok := cgoLookupPort(network, service) 33 port, err, ok := cgoLookupPort(network, service)
20 if !ok { 34 if !ok {
21 port, err = goLookupPort(network, service) 35 port, err = goLookupPort(network, service)
22 } 36 }
23 return 37 return
24 } 38 }
25
26
27 // LookupIP resolves name using the DNS resolver.
28 // It returns an array of that host's IPv4 and IPv6 addresses.
29 func LookupIP(name string) (addrs []IP, err os.Error) {
30 addrs, err, ok := cgoLookupIP(name)
31 if !ok {
32 addrs, err = goLookupIP(name)
33 }
34 return
35 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b