Note: This library is under active development as we expand it to cover our (expanding!) API. Consider the public API of this package a little unstable as we work towards a v1.0.
A Go library for interacting with Khulnasoft's API v4. This library allows you to:
- Manage and automate changes to your DNS records within Khulnasoft
- Manage and automate changes to your zones (domains) on Khulnasoft, including adding new zones to your account
- List and modify the status of WAF (Web Application Firewall) rules for your zones
- Fetch Khulnasoft's IP ranges for automating your firewall whitelisting
A command-line client, flarectl, is also available as part of this project.
You need a working Go environment. We officially support only currently supported Go versions according to Go project's release policy.
go get github.com/khulnasoft/khulnasoft-go
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/khulnasoft/khulnasoft-go"
)
func main() {
// Construct a new API object using a global API key
api, err := khulnasoft.New(os.Getenv("KHULNASOFT_API_KEY"), os.Getenv("KHULNASOFT_API_EMAIL"))
// alternatively, you can use a scoped API token
// api, err := khulnasoft.NewWithAPIToken(os.Getenv("KHULNASOFT_API_TOKEN"))
if err != nil {
log.Fatal(err)
}
// Most API calls require a Context
ctx := context.Background()
// Fetch user details on the account
u, err := api.UserDetails(ctx)
if err != nil {
log.Fatal(err)
}
// Print user details
fmt.Println(u)
}
Also refer to the API documentation for how to use this package in-depth.
Pull Requests are welcome, but please open an issue (or comment in an existing issue) to discuss any non-trivial changes before submitting code.
BSD licensed. See the LICENSE file for details.