Go
Go 1.21+. Standard library only.
Install
go get github.com/Uncle-Cole/GeckoSDK/go
import geckoguard "github.com/Uncle-Cole/GeckoSDK/go"
Quick start
package main
import (
"context"
"errors"
"log"
"time"
geckoguard "github.com/Uncle-Cole/GeckoSDK/go"
)
func main() {
client, err := geckoguard.NewClient("gg_live_...", "your-product-uuid")
if err != nil {
log.Fatal(err)
}
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
resp, err := client.Authorize(ctx, "LICENSE-KEY-123", nil)
var denied *geckoguard.LicenseDeniedError
if errors.As(err, &denied) {
log.Fatalf("denied: %s", denied.ReasonCode)
}
if err != nil {
log.Fatal(err)
}
log.Printf("allowed: %v", resp.Allow)
}
The returned *Client is safe for concurrent use.
Configuration
client, err := geckoguard.NewClient("gg_live_...", "your-product-uuid",
geckoguard.WithBaseURL("https://api.geckoguard.net"),
geckoguard.WithSigningSecret("..."), // enable HMAC request signing
geckoguard.WithHTTPClient(customClient), // custom timeouts / proxy
)
For the full method list and endpoint reference, see the API Reference.