Skip to content

Go SDK (seatling-sdk-go)

The official Seatling Go SDK (github.com/seatling/seatling-sdk-go/v2) wraps the native Seatling Rust core engine via monolithic static CGO linking (libseatling.a), providing sub-microsecond lock-free authorization checks (~40ns, 0 heap allocations) and zero runtime dynamic library extraction.


Terminal window
go get github.com/seatling/seatling-sdk-go/v2

[!NOTE] Because seatling-sdk-go statically links the Rust core engine, compile your application with CGO_ENABLED=1 (e.g. CGO_ENABLED=1 go build -o myapp main.go).


package main
import (
"fmt"
"log"
"github.com/seatling/seatling-sdk-go/v2"
)
func main() {
// 1. Configure the Seatling Client with your Workspace & Product public keys
cfg := seatling.Config{
WorkspaceID: "ws_01j8k9m0n1p2q3r4s5t6u7v8w9",
ProductID: "prod_enterprise_suite",
PublicKeys: map[string]string{
"prod_key_2026_v1": "6kpsY+KcUgq+9VB7Ey7F+ZVHdq6+vnuSQh7qaRRG0iw=",
},
AppVersion: "1.0.0",
}
client, err := seatling.New(cfg)
if err != nil {
log.Fatalf("Failed to construct Seatling client: %v", err)
}
defer client.Close()
// 2. Instant offline cache initialization (< 1ms, non-blocking, zero network I/O)
status, err := client.Initialize()
if err != nil {
log.Fatalf("Initialization error: %v", err)
}
fmt.Printf("[Startup] Offline Lease Status: %s\n", status)
// 3. Activate online if not yet authorized locally
if !client.IsAuthorized() {
res, err := client.ActivateDetailed("SEAT-8F92-4B11-90E1")
if err != nil || !res.Success {
if res.Status == seatling.StatusSeatsExhausted || res.Status == seatling.StatusRequiresPortalDeactivation {
log.Fatalf("Seat limit reached (%d/%d). Transfer a seat at: %s", res.SeatsActive, res.SeatLimit, res.PortalURL)
}
log.Fatalf("Activation rejected (%s): %s", res.Status, res.Message)
}
fmt.Printf("✓ Activated seat %s!\n", res.SeatID)
}
// 4. Ultra-fast lock-free hot-path check (~40ns, 0 heap allocations)
if client.IsAuthorized() {
maxWorkers := client.GetEntitlementInt64("max_workers", 16)
allowExport := client.GetEntitlementBool("allow_export", true)
fmt.Printf("✓ Authorized! max_workers=%d, allow_export=%v\n", maxWorkers, allowExport)
}
}

Hardware anchor derivation (HKDF-SHA256, domain-scoped to workspace_id, product_id, and license_key) is encapsulated strictly inside seatling.Client (Art. 25(2) GDPR Data Protection by Default) so application code cannot inadvertently log or exfiltrate device fingerprints. For offline testing and diagnostics, the pure weighted fuzzy quorum helper remains available:

// Evaluate hardware drift with weighted fuzzy quorum scoring (threshold >= 70)
score, err := seatling.WeightedScore(baselineComponents, currentComponents)
if err == nil && score >= 70 {
fmt.Printf("Hardware quorum verified: %d/100\n", score)
}

  • Built-In Data Minimization (Art. 5(1)(c) & Art. 25(2)): seatling-sdk-go never reads or transmits OS hostnames, OS usernames, or MAC addresses—only coarse os, os_version, app_version, and domain-scoped, license-keyed HKDF-SHA256 pseudonymized hardware hashes (Art. 4(5) GDPR).
  • Zero-PII Logging (Art. 32): Never log raw license keys or full buyer emails in production logs; log only opaque SeatID / status codes.
  • End-User Disclosures (Art. 13): Review Privacy & GDPR Compliance for accurate Privacy Policy wording and in-app deactivation (client.Deactivate()) guidance.