A Go SDK for interacting with IPFS HTTP gateway services. Provides a clean, idiomatic interface for common IPFS operations including pinning, DNS management, IPNS, website deployment, and file uploads.
- Pinning Service - Pin and unpin content using.boxo client
- DNS Service - Manage DNS zones and records with DNSLink support
- IPNS Service - Inter-Planetary Naming System key management
- Websites Service - Deploy and manage gateway websites
- Upload Service - TUS resumable uploads and HTTP POST with memory-efficient CAR generation
- OpenAPI-driven - Code generated from
swagger.yamlfor type safety - Configurable retry - Exponential backoff with customizable attempts
go get go.lumeweb.com/ipfs-sdkimport (
"context"
"log"
"go.lumeweb.com/ipfs-sdk"
)
func main() {
client, err := ipfs.NewClient("https://api.example.com", "your-bearer-token")
if err != nil {
log.Fatal(err)
}
ctx := context.Background()
// List all pins
pins, err := client.Pinning().ListPins(ctx)
if err != nil {
log.Fatal(err)
}
log.Printf("Found %d pins", len(pins))
}// List, add, get status, and remove pins
pins, _ := client.Pinning().ListPins(ctx)
c, _ := cid.Decode("QmYourCidHere")
pin, _ := client.Pinning().AddPin(ctx, c)
status, _ := client.Pinning().GetPin(ctx, pin.GetRequestId())
client.Pinning().RemovePin(ctx, pin.GetRequestId())// Manage DNS zones and DNSLink records
zones, _ := client.DNS().ListZones(ctx)
zone, _ := client.DNS().CreateZone(ctx, "example.com", nameservers)
record, _ := client.DNS().CreateRecord(ctx, zone.Id, request)
records, _ := client.DNS().ListRecords(ctx, zone.Id)// List, create, publish, and resolve IPNS keys
keys, _ := client.IPNS().ListKeys(ctx)
key, _ := client.IPNS().CreateKey(ctx, "my-key")
publishResult, _ := client.IPNS().Publish(ctx, key.Id, cid)
resolveResult, _ := client.IPNS().Resolve(ctx, name)// Deploy and manage gateway websites
websites, _ := client.Websites().List(ctx)
site, _ := client.Websites().Create(ctx, "domain.com", cid, "ipfs")
updatedSite, _ := client.Websites().Update(ctx, site.Id, domain, cid, protocol)// Upload files with automatic TUS/POST selection
file, _ := os.Open("path/to/file.txt")
result, _ := client.Upload().Upload(ctx, file, "file.txt", ipfs.UploadOptions{
MemoryLimit: 100 * 1024 * 1024,
WrapInDir: true,
})
// result.CID contains the uploaded content CIDimport (
"time"
httputil "go.lumeweb.com/ipfs-sdk/internal/http"
)
retryConfig := httputil.RetryConfig{
Attempts: 5,
MaxJitter: 10 * time.Second,
MaxDelay: 60 * time.Second,
}
client, _ := ipfs.NewClient(
"https://api.example.com",
"your-token",
ipfs.WithRetryConfig(retryConfig),
)Default retry configuration:
- 3 attempts with exponential backoff
- Unrecoverable codes (not retried): 400, 401, 403, 404, 405, 409, 422
- Rate limit (429) always retried
The SDK uses a layered architecture:
Client Entry Point (Pinning, DNS, IPNS, Websites, Upload)
↓
Service Interfaces (Type-safe adapters)
↓
Generated OpenAPI Client (swagger.yaml → oapi-codegen)
↓
HTTP Infrastructure (Retry, Auth, net/http)
Implements two-pass CAR generation for memory-efficient large file handling:
- Pass 1: Build summary with metadata (CIDs, sizes, tree structure)
- Pass 2: Generate CARv1 on demand using LRU blockstore (default 100MB limit)
- Enables processing of content larger than available RAM
# Build
go build -v ./...
# Test with coverage
go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
go tool cover -func=coverage.out
# Generate code
go generate ./internal/client
mockery
# Dependencies
go mod download
go mod tidySee AGENTS.md for development guidelines and project architecture details.
MIT License – see LICENSE for details.
Copyright (c) 2026 Hammer Technologies LLC