Skip to content

Commit

Permalink
Fix first set of undefined errors...
Browse files Browse the repository at this point in the history
Signed-off-by: grant <[email protected]>
  • Loading branch information
grantseltzer committed Mar 8, 2019
1 parent a628c74 commit 05b9e5f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/net/lookup_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (r *Resolver) lookupHost(ctx context.Context, host string) (addrs []string,

// darwin has unique resolution files, use libSystem binding if cgo is disabled.
if runtime.GOOS == "darwin" {
addrs, err := resSearch(ctx, host, int32(dnsmessage.TypeALL), int32(dnsmessage.ClassINET))
addrs, err := resolverSearch(ctx, host, int32(dnsmessage.TypeALL), int32(dnsmessage.ClassINET))
if err == nil {
return addrs, nil
}
Expand All @@ -114,7 +114,7 @@ func (r *Resolver) lookupIP(ctx context.Context, network, host string) (addrs []

// darwin has unique resolution files, use libSystem binding if cgo is disabled.
if runtime.GOOS == "darwin" {
addrs, err := resSearch(ctx, host, int32(dnsmessage.TypeALL), int32(dnsmessage.ClassINET))
addrs, err := resolverSearch(ctx, host, int32(dnsmessage.TypeALL), int32(dnsmessage.ClassINET))
if err == nil {
return addrs, nil
}
Expand Down Expand Up @@ -152,7 +152,7 @@ func (r *Resolver) lookupCNAME(ctx context.Context, name string) (string, error)

// darwin has unique resolution files, use libSystem binding if cgo is not an option.
if runtime.GOOS == "darwin" {
addrs, err := resSearch(ctx, host, int32(dnsmessage.TypeCNAME), int32(dnsmessage.ClassINET))
addrs, err := resolverSearch(ctx, name, int32(dnsmessage.TypeCNAME), int32(dnsmessage.ClassINET))
if err == nil {
return addrs, nil
}
Expand Down Expand Up @@ -405,7 +405,7 @@ func resolverSearch(ctx context.Context, hostname string, rtype, class int32) ([
}

// parse received answers
var dnsParser dnsmessage.Parserw
var dnsParser dnsmessage.Parser

if _, err := dnsParser.Start(responseBuffer); err != nil {
return nil, err
Expand All @@ -422,7 +422,7 @@ func resolverSearch(ctx context.Context, hostname string, rtype, class int32) ([
}

if !strings.EqualFold(h.Name.String(), hostname) {
if err := p.SkipAnswer(); err != nil {
if err := dnsParser.SkipAnswer(); err != nil {
return nil, err
}
continue
Expand All @@ -434,20 +434,20 @@ func resolverSearch(ctx context.Context, hostname string, rtype, class int32) ([
if err != nil {
return nil, err
}
answers = append(answers, fmt.Strinf("%s", r.A))
answers = append(answers, fmt.Stringf("%s", r.A))
case dnsmessage.TypeAAAA:
r, err := dnsParser.AAAAResource()
if err != nil {
return nil, err
}
answers = append(answers, fmt.Strinf("%s", r.AAAA))
answers = append(answers, fmt.Stringf("%s", r.AAAA))

case dnsmessage.TypeCNAME:
r, err := dnsParser.CNAMEResource()
if err != nil {
return nil, err
}
answers = append(answers, fmt.Strinf("%s", r.Name))
answers = append(answers, fmt.Stringf("%s", r.Name))
}
}
return answers, nil
Expand Down

0 comments on commit 05b9e5f

Please sign in to comment.