Go client library
pkg/client is the supported Go library for applications that submit debuglets and read their results from a dispatcher. It is a client library, not the SDK for writing a debuglet; use pkg/debuglet for that.
Use it
Section titled “Use it”Create a client with a dispatcher endpoint and a credential, then create an intent and submit a debuglet. The working example is in examples/client.
client, err := client.New(client.Options{ Endpoint: "https://dispatcher.example", Credential: sessionToken,})if err != nil { /* handle error */ }The library follows the HTTP API contract, including authentication, request validation, submission, state, logs, and cancellation. Pin the module version you test and treat the OpenAPI document as the wire-level reference.
See measurement workflows for account-owned profiles, paginated
batch details, RetryTEST and the two-executor RendezvousTEST helper.
Client.Recovery(ctx, id) makes one bounded request for recovery inspection. Unknown classifications and failed workloads are successful inspections; transport and HTTP errors retain their normal types. Older dispatchers without this endpoint return an HTTP 404. The SDK continues to request its 1.3 minimum for existing operations.
Client.DiscoverExecutors and Client.SelectExecutor provide capability-aware discovery. Unknown capabilities fail requested filters; selection does not reserve capacity or submit work.
Read output
Section titled “Read output”Client.Logs(ctx, id, options) returns one page and its Output metadata.
Output.State is unknown, pending, complete, or truncated; future values
are preserved and must be treated conservatively. Missing metadata from an older
server becomes unknown. The SDK retains its API 1.3 minimum and validates
recognized states without requiring all operations to use API 1.6.
A follower should advance by page.After, drain full pages, and finish only when
it reaches *page.Output.FinalCursor for complete or truncated output. Complete
output is independent of workload exit. Truncated output remains incomplete;
LossReason explains why, including future reason values. Do not interpret
HasMore == false or a terminal workload as proof of completion. After draining
a terminal legacy run, report *client.IncompleteOutputError instead of success.
The CLI follows these rules; the SDK page method itself does not poll or fail
merely because output is pending, unknown, or truncated.
Choose an integration surface
Section titled “Choose an integration surface”| Need | Use |
|---|---|
| Shell workflow, demos, and operations | dbl |
| Go application that calls a dispatcher | pkg/client |
| WebAssembly measurement written in Go | pkg/debuglet |
| Another language | HTTP API |
Client.AttributionCandidates(ctx, ip, at) and Client.AttributionKeys(ctx, executorID, chainID, fromEpoch, toEpoch) read the public probe verification history on API 1.11 or newer and work on a client without a credential. The first lists the runs active from an address within one epoch of a time, each with its chain schedule (a TagSpec of TagSpecVersionLegacy is a pre-v1 chain that tag spec v1 cannot verify); an empty answer for a time before RetainedFrom is no evidence either way. The second pages a chain’s disclosed keys, 1024 epochs at a time, following NextEpoch; check every key against the schedule’s K0 before use. Older dispatchers return 404.
client.ReadCapture(r) reads a pcap or pcapng capture (Ethernet with VLAN tags, raw IP, Linux cooked SLL and SLL2, BSD loopback; microsecond, nanosecond and pcapng if_tsresol timestamps) of at most 64 MiB and 1 000 000 packets; a larger, malformed or truncated capture is a *client.CaptureError, never a partial read. Client.Verify(ctx, packets, client.VerifyOptions{At, Offline, ClockTolerance}) attributes those packets to runs as probe verification describes: it groups them by source address and epoch, looks each group up in the attribution history above and checks the tags offline against the disclosed keys, with the tag functions of pkg/tagspec that the executor’s taggers use. Groups whose key is not disclosed yet are then sent to POST /attribution/verify (at most 256 packets and 16 groups per request, paced like the lookups); the dispatcher’s executor answers before disclosure, Verify checks the signed receipt against GET /attribution/receipt-keys (Client.AttributionVerify, Client.AttributionReceiptKeys) and such a group records Method server and the ReceiptKeyID. A dispatcher without the route leaves them pending, and a receipt that does not verify is an *EvidenceReceiptError. With Offline nothing is uploaded. It needs no credential. The VerifyReport has one VerifyGroup per group with its Verdict (verified, invalid, pending, missing, unsupported), machine Reason, Detail, Method, RunID, ExecutorID, Epoch, Time, PendingUntil, Packets, the Matched/Unmatched counts and, when verified, FalseMatchBound and DisclosedAt. Only a capture or dispatcher that cannot be read is an error; ErrNoAttributionHistory names a dispatcher older than API 1.11. report.Evidence() returns the evidence bundle, client.WriteEvidence and client.ReadEvidence store it, and client.VerifyEvidence(ctx, ev) repeats the check offline from the bundle alone, failing with ErrEvidenceDigest, an *EvidenceReceiptError (a receipt whose signature, key ID, key validity or packet digest does not check out under the receipt keys the bundle embeds) or an *EvidenceMismatchError when it was altered. The embedded receipt keys are the dispatcher’s claim: compare their IDs with its GET /attribution/receipt-keys.
Client.Cancellation(ctx, id) inspects a durable cancellation request on API 1.9 or newer. It does not retry delivery. AcknowledgedAt == nil means the executor acknowledgement is unknown, including when the run has a local terminal result. Older dispatchers can return 404 for this optional route; Client.Cancel retains its existing signature and compatibility.
Browser-approved credentials
Section titled “Browser-approved credentials”StartDeviceLogin requests explicit scopes for the client’s configured dispatcher.
Display its VerificationURI and UserCode; keep DeviceCode private. Call
PollDeviceLogin no faster than the returned interval, honor slow_down, and stop
on denial, expiry or consumption. Pass the approved token to WithCredential.
CancelDeviceLogin ends an abandoned request, CredentialStatus reports its
audience and permissions, and Logout revokes it. Provider tokens never belong in
Credential. See authentication.