diff --git a/README.md b/README.md index 0feab9c..18c1004 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,10 @@ To list all RRSet records matching `www.farsightsecurity.com`: ```go records, _, err := client.RRSet.LookupName("www.farsightsecurity.com", nil) if err != nil { - panic(err) + panic(err) } for _, record := range records { - fmt.Println("%s: %v", *record.RRName, record.RData) + fmt.Println("%s: %v", *record.RRName, record.RData) } ``` For furthur usage see the [GoDocs][doc]. @@ -23,12 +23,40 @@ For furthur usage see the [GoDocs][doc]. The `dnsdb` library does not directly handle authentication. Instead, when creating a new client, you can pass a `http.Client` that handles authentication for you. It does provide a `APIKeyTransport` structure when using API Key authentication. It is used like this: ```go tp := dnsdb.APIKeyTransport{ - APIKey: "d41d8cd98f00b204e9800998ecf8427e", + APIKey: "<>", } client := dnsdb.NewClient(tp.Client()) ``` + +Assemblying those two fragments of code into a complete GoLang program: +```go +package main + +import "github.com/bored-engineer/go-dnsdb" +import "fmt" + +func main() { + fmt.Println("starting dnsdb api test...") + + tp := dnsdb.APIKeyTransport{ + APIKey: "<>", + } + + client := dnsdb.NewClient(tp.Client()) + + records, _, err := client.RRSet.LookupName("www.farsightsecurity.com", nil) + if err != nil { + panic(err) + } + + for _, record := range records { + fmt.Println("%s: %v", *record.RRName, record.RData) + } +} +``` + [doc-img]: https://godoc.org/github.com/bored-engineer/go-dnsdb?status.svg [doc]: https://godoc.org/github.com/bored-engineer/go-dnsdb [ci-img]: https://travis-ci.org/bored-engineer/go-dnsdb.svg?branch=master