pkg/

directory
v0.30.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0

Directories

Path Synopsis
Package adapters names the wire protocol the relay speaks to an upstream.
Package adapters names the wire protocol the relay speaks to an upstream.
catalogkind
archive
Package archive extracts a catalog release's data tarball with the limits relay and the catalog server share.
Package archive extracts a catalog release's data tarball with the limits relay and the catalog server share.
binding
Package binding is the domain layer for the HostBinding entity — the first-class join that declares "Model M is served by Host H, via wire adapter A, under upstream name U, priced by Pricing P."
Package binding is the domain layer for the HostBinding entity — the first-class join that declares "Model M is served by Host H, via wire adapter A, under upstream name U, priced by Pricing P."
embed
Package embed flattens catalog kinds into the SDK catalog document (sdk/catalog): from a parsed catalog tree (Compose) or from any Source, such as relay's live snapshot (Flatten).
Package embed flattens catalog kinds into the SDK catalog document (sdk/catalog): from a parsed catalog tree (Compose) or from any Source, such as relay's live snapshot (Flatten).
families
Package families reads a catalog's families.yaml: the allowlist of Model spec.family values, each with the spec.productLine values valid under it and the logo its models share.
Package families reads a catalog's families.yaml: the allowlist of Model spec.family values, each with the spec.productLine values valid under it and the logo its models share.
host
Package host is the domain layer for the Host entity — a serving endpoint the relay forwards requests to.
Package host is the domain layer for the Host entity — a serving endpoint the relay forwards requests to.
manifest
Package manifest reads the catalog kinds (Provider, Host, Model, Pricing, HostBinding, Policy, RateLimit) from their YAML wire form, which references entities by name, and translates them to the pkg/catalogkind domain structs, which reference them by id.
Package manifest reads the catalog kinds (Provider, Host, Model, Pricing, HostBinding, Policy, RateLimit) from their YAML wire form, which references entities by name, and translates them to the pkg/catalogkind domain structs, which reference them by id.
model
Package model is the domain layer for the Model entity — a container for a family of dated checkpoints (Snapshots).
Package model is the domain layer for the Model entity — a container for a family of dated checkpoints (Snapshots).
policy
Package policy is the domain layer for the Policy entity: a reusable rule set a policy binding applies to accounts.
Package policy is the domain layer for the Policy entity: a reusable rule set a policy binding applies to accounts.
pricing
Package pricing is the domain layer for the Pricing entity — a named rate sheet owned by a Host and applied to one or more Models.
Package pricing is the domain layer for the Pricing entity — a named rate sheet owned by a Host and applied to one or more Models.
provider
Package provider is the domain layer for the Provider entity — the vendor / author of a Model.
Package provider is the domain layer for the Provider entity — the vendor / author of a Model.
ratelimit
Package ratelimit is the domain layer for the RateLimit entity — a named rule set (requests / tokens / concurrency caps) attachable to a Policy, ProviderKey, or Model.
Package ratelimit is the domain layer for the RateLimit entity — a named rule set (requests / tokens / concurrency caps) attachable to a Policy, ProviderKey, or Model.
Package chttl keeps a ClickHouse MergeTree table's row TTL equal to a retention setting.
Package chttl keeps a ClickHouse MergeTree table's row TTL equal to a retention setting.
Package clientprofile identifies which coding agent (Claude Code, Codex, OpenCode, …) is calling the relay, so the edge can serve each one the model-list shape, error wording and attribution it expects.
Package clientprofile identifies which coding agent (Claude Code, Codex, OpenCode, …) is calling the relay, so the edge can serve each one the model-list shape, error wording and attribution it expects.
Package connadmit admits connections to an HTTP listener: up to a cap they are served, past it they wait in a bounded FIFO for a slot for at most a fixed time, and the rest are answered with a 503 and closed.
Package connadmit admits connections to an HTTP listener: up to a cap they are served, past it they wait in a bounded FIFO for a slot for at most a fixed time, and the rest are answered with a 503 and closed.
Package contentcoding decodes HTTP entity bodies by their Content-Encoding.
Package contentcoding decodes HTTP entity bodies by their Content-Encoding.
Package coord is cross-pod coordination for app components over a shared store.
Package coord is cross-pod coordination for app components over a shared store.
Package crypto provides AES-GCM-256 encryption primitives and master-key helpers for Relay's stored-secret subsystem, plus the claim set inference tokens carry (token_claims.go; the token format itself is auth/token).
Package crypto provides AES-GCM-256 encryption primitives and master-key helpers for Relay's stored-secret subsystem, plus the claim set inference tokens carry (token_claims.go; the token format itself is auth/token).
Package engine keeps derived state consistent with a set of input rows.
Package engine keeps derived state consistent with a set of input rows.
cell
Package cell owns long-lived runtime state (counters, breaker copies, rotation state, shared caches) keyed by stable ids, so the state outlives the published generations that point at it.
Package cell owns long-lived runtime state (counters, breaker copies, rotation state, shared caches) keyed by stable ids, so the state outlives the published generations that point at it.
internal/celllink
Package celllink carries the link changes of a published generation from package engine to package cell.
Package celllink carries the link changes of a published generation from package engine to package cell.
Package filter is a declarative, allowlist-based query engine for list endpoints.
Package filter is a declarative, allowlist-based query engine for list endpoints.
Package httpheader holds the header sets applied at relay's HTTP edges: what is stripped from inbound requests before forwarding, what is removed from upstream responses, and what an upstream failure may carry onto the error relay writes.
Package httpheader holds the header sets applied at relay's HTTP edges: what is stripped from inbound requests before forwarding, what is removed from upstream responses, and what an upstream failure may carry onto the error relay writes.
Package httpmw holds net/http middleware and helpers shared by relay's listeners: request body size limits, client IP resolution behind trusted proxies, and browser security headers.
Package httpmw holds net/http middleware and helpers shared by relay's listeners: request body size limits, client IP resolution behind trusted proxies, and browser security headers.
Package ids generates immutable resource identifiers.
Package ids generates immutable resource identifiers.
kv
Package kv is the key-value store for short-lived operational state (counters, breaker state, locks, sessions), with an in-memory backend and a Redis-protocol backend behind the same Store interface.
Package kv is the key-value store for short-lived operational state (counters, breaker state, locks, sessions), with an in-memory backend and a Redis-protocol backend behind the same Store interface.
kvtest
Package kvtest holds kv fixtures for tests: a Recording store that pins the scripts a caller runs, and (integration builds) a Dragonfly keyspace of its own per test on the server named by RELAY_TEST_REDIS_ADDR, so test packages run in parallel against one server despite fixed key names and prefix scans.
Package kvtest holds kv fixtures for tests: a Recording store that pins the scripts a caller runs, and (integration builds) a Dragonfly keyspace of its own per test on the server named by RELAY_TEST_REDIS_ADDR, so test packages run in parallel against one server despite fixed key names and prefix scans.
Package lifecycle is the in-process hook registry every request-runner (pipeline, proxy, future ws/batch) fires events into.
Package lifecycle is the in-process hook registry every request-runner (pipeline, proxy, future ws/batch) fires events into.
Package meta holds the identity primitives every domain entity carries: UUIDv7 id, DNS-1123 slug name, free-text display name, and provenance.
Package meta holds the identity primitives every domain entity carries: UUIDv7 id, DNS-1123 slug name, free-text display name, and provenance.
Package metrics owns the Prometheus registry and the /metrics HTTP handler.
Package metrics owns the Prometheus registry and the /metrics HTTP handler.
Package modelref parses the catalog reference DSL used by Policy grants and the /catalog/resolve admin endpoint.
Package modelref parses the catalog reference DSL used by Policy grants and the /catalog/resolve admin endpoint.
Package otlp is the wire side of an OpenTelemetry receiver over OTLP/HTTP for the traces and logs signals: it reads and decodes export requests (protobuf and JSON), exposes their spans and log records in a neutral shape, and encodes the export response.
Package otlp is the wire side of an OpenTelemetry receiver over OTLP/HTTP for the traces and logs signals: it reads and decodes export requests (protobuf and JSON), exposes their spans and log records in a neutral shape, and encodes the export response.
genai
Package genai maps spans and events that follow the OpenTelemetry GenAI semantic conventions to otlp.Inference records.
Package genai maps spans and events that follow the OpenTelemetry GenAI semantic conventions to otlp.Inference records.
Package payload is the storage contract for request/response body capture: the Record shape and the Sink/Reader interfaces its backends satisfy.
Package payload is the storage contract for request/response body capture: the Record shape and the Sink/Reader interfaces its backends satisfy.
clickhouse
Package clickhouse provides a ClickHouse-backed implementation of payload.Sink, payload.Reader, and payload.Closer — the "text bodies in ClickHouse" backend for the Logs view.
Package clickhouse provides a ClickHouse-backed implementation of payload.Sink, payload.Reader, and payload.Closer — the "text bodies in ClickHouse" backend for the Logs view.
dedup
Package dedup splits a JSON request body into a skeleton and content-addressed pieces, and rebuilds the exact bytes from them.
Package dedup splits a JSON request body into a skeleton and content-addressed pieces, and rebuilds the exact bytes from them.
file
Package file is the JSONL file backend for payload logging: one Record per line.
Package file is the JSONL file backend for payload logging: one Record per line.
s3
Package s3 is the object-store backend for payload logging: one JSON object per Record.
Package s3 is the object-store backend for payload logging: one JSON object per Record.
Package ratelimit implements a sliding-window-counter rate limiter with a two-phase Reserve/Commit API.
Package ratelimit implements a sliding-window-counter rate limiter with a two-phase Reserve/Commit API.
Package reqbody builds outbound HTTP request bodies over an in-memory buffer that stop referencing the buffer once the transport is done with it.
Package reqbody builds outbound HTTP request bodies over an in-memory buffer that stop referencing the buffer once the transport is done with it.
Package reqid gives each HTTP request a relay-minted ULID, echoes it as X-Relay-Request-ID, and carries it with a request-scoped logger in the context.
Package reqid gives each HTTP request a relay-minted ULID, echoes it as X-Relay-Request-ID, and carries it with a request-scoped logger in the context.
secret
oauth
Package oauth resolves OAuth credentials for the relay's secret layer.
Package oauth resolves OAuth credentials for the relay's secret layer.
onepassword
Package onepassword resolves secret.KindOnePassword refs via the official 1Password Go SDK and a service-account token.
Package onepassword resolves secret.KindOnePassword refs via the official 1Password Go SDK and a service-account token.
Package slug derives DNS-1123-compatible identifiers from free-text display names, with deterministic collision suffixes.
Package slug derives DNS-1123-compatible identifiers from free-text display names, with deterministic collision suffixes.
Package sse holds server-sent-events helpers for the response path.
Package sse holds server-sent-events helpers for the response path.
Package transport defines the transport-agnostic Message and Channel types that carry request and response payloads between a transport and a processing pipeline.
Package transport defines the transport-agnostic Message and Channel types that carry request and response payloads between a transport and a processing pipeline.
Package usage defines the per-request usage Event, the Sink and Reader interfaces its storage backends implement, and the in-memory filtering and aggregation shared by scan-style backends.
Package usage defines the per-request usage Event, the Sink and Reader interfaces its storage backends implement, and the in-memory filtering and aggregation shared by scan-style backends.
clickhouse
Package clickhouse provides a ClickHouse-backed implementation of usage.Sink, usage.Reader, and usage.Closer.
Package clickhouse provides a ClickHouse-backed implementation of usage.Sink, usage.Reader, and usage.Closer.
file
Package file is the JSONL file backend for usage logging: a Sink that appends one event per line and a Reader that scans the same file.
Package file is the JSONL file backend for usage logging: a Sink that appends one event per line and a Reader that scans the same file.
postgres
Package postgres implements usage.Sink, usage.Reader, and usage.Closer backed by PostgreSQL.
Package postgres implements usage.Sink, usage.Reader, and usage.Closer backed by PostgreSQL.
usagetest
Package usagetest is the conformance suite every usage.Reader backend runs: one fixed event fixture, one table of queries per Reader method, and the results every backend must return for them.
Package usagetest is the conformance suite every usage.Reader backend runs: one fixed event fixture, one table of queries per Reader method, and the results every backend must return for them.
valkey
Package valkey is a TTL-bounded usage Sink + Reader backed by pkg/kv.
Package valkey is a TTL-bounded usage Sink + Reader backed by pkg/kv.
Package wal is a durable write-ahead log for asynchronous sinks.
Package wal is a durable write-ahead log for asynchronous sinks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL