Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand All @@ -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: "<<your API key here>>",
}

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: "<<your API key here>>",
}

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
Expand Down