go-easydns/example-client/main.go

27 lines
662 B
Go
Raw Permalink Normal View History

package main
import (
"fmt"
"log"
easydns "deadbeef.codes/steven/goeasydns"
)
func main() {
2019-06-23 07:02:46 +00:00
client := easydns.NewClient("https://sandbox.rest.easydns.net", "APITOKEN", "APIKEY") //change url to remove sandbox once you contact easydns support
2019-06-23 07:01:47 +00:00
recordList, err := client.GetRecordList("myeasydnssite.ca")
if err != nil {
2019-06-23 07:01:47 +00:00
log.Fatalf("failed to get records for myeasydnssite.ca: %v", err)
}
for _, record := range recordList.Data {
if record.Type == "TXT" {
fmt.Printf("ID: %s\n", record.ID)
fmt.Printf("Host: %s\n", record.Host)
fmt.Printf("Type: %s\n", record.Type)
fmt.Printf("rdata: %s\n", record.Rdata)
fmt.Printf("\n\n")
}
}
}