Skip to content

Commit

Permalink
Add dns.Fqdn
Browse files Browse the repository at this point in the history
  • Loading branch information
miekg committed Mar 23, 2013
1 parent dc6bfab commit c4e35ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func (u *Unbound) LookupIP(host string) (addrs []net.IP, err error) {
u.ResolveAsync(host, dns.TypeA, dns.ClassINET, c)
u.ResolveAsync(host, dns.TypeAAAA, dns.ClassINET, c)
seen := 0
println("BOE1")
Wait:
for {
select {
Expand Down
9 changes: 4 additions & 5 deletions tutorial1/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package main

import (
"fmt"
"github.com/miekg/dns"
"github.com/miekg/unbound"
"log"
)
Expand All @@ -12,12 +13,10 @@ func main() {
u := unbound.New()
defer u.Destroy()

addr, err := u.LookupHost("wwww.nlnetlabs.nl")
u.ResolvConf("/etc/resolv.conf")
r, err := u.Resolve("www.nlnetlabs.nl.", dns.TypeA, dns.ClassINET)
if err != nil {
log.Fatalf("error %s\n", err.Error())
}

for _, a := range addr {
fmt.Printf("The address is %s\n", a)
}
fmt.Printf("%+v\n", r)
}
2 changes: 1 addition & 1 deletion unbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (u *Unbound) Destroy() {

// ResolvConf wraps Unbound's ub_ctx_resolvconf.
func (u *Unbound) ResolvConf(fname string) error {
cfname := C.CString(fname)
cfname := C.CString(dns.Fqdn(fname))
defer C.free(unsafe.Pointer(cfname))
i := C.ub_ctx_resolvconf(u.ctx, cfname)
return newError(int(i))
Expand Down

0 comments on commit c4e35ee

Please sign in to comment.