GCore for libdns
This package implements the libdns interfaces for GCore, allowing you to manage DNS records.
To authenticate you need to supply a GCore API Key.
Here's a minimal example of how to get all DNS records for zone.
// Package main provides a simple example of how to use the libdns-gcore package.
package main
import (
"context"
"fmt"
"os"
"path/filepath"
gcore "github.com/libdns/gcore"
)
func main() {
apiKey := os.Getenv("GCORE_API_KEY")
if apiKey == "" {
fmt.Printf("GCORE_API_KEY not set\n")
return
}
if len(os.Args) < 2 {
fmt.Printf("Usage: %s <zone>\n", filepath.Base(os.Args[0]))
os.Exit(1)
}
zone := os.Args[1]
provider := &gcore.Provider{
APIKey: apiKey,
}
records, err := provider.GetRecords(context.Background(), zone)
if err != nil {
fmt.Printf("Error: %s", err.Error())
return
}
fmt.Println(records)
}