# Libunbound wrapper in Go I've created a small wrapper for [libunbound](https://unbound.net) for use in [Go](http://www.golang.org). The code can be [found at github](http://github.com/miekg/unbound). It depends on my Go DNS library which can be [found here](http://github.com/miekg/dns). [Official announcement on the Unbound-users@ list](https://unbound.nlnetlabs.nl/pipermail/unbound-users/2012-July/002431.html). To give you a little taste of how it looks, I've (re)created tutorials 2 to 6 in Go. Tutorial 2 looks like this, for instance: package main // https://www.unbound.net/documentation/libunbound-tutorial-2.html import ( "dns" "fmt" "os" "unbound" ) func main() { u := unbound.New() defer u.Destroy() if err := u.ResolvConf("/etc/resolv.conf"); err != nil { fmt.Printf("error %s\n", err.Error()) os.Exit(1) } if err := u.Hosts("/etc/hosts"); err != nil { fmt.Printf("error %s\n", err.Error()) os.Exit(1) } r, err := u.Resolve("www.nlnetlabs.nl.", dns.TypeA, dns.ClassINET) if err != nil { fmt.Printf("error %s\n", err.Error()) os.Exit(1) } fmt.Printf("%+v\n", r) }