Help us shape the future of Go! Take the 2026 Go Developer Survey

utilconn

package
v1.149.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package utilconn seeds the built-in "util" API-gateway connection (issue #1005): a handler=internal connection whose operations are served in-process (internal/platform/utilhandler) and discovered through the same catalog path as any other api connection. Composed only by pkg/platform's runtime wiring; the seam keeps the seed off the Platform struct (the god-object budget is frozen, #854).

Access model: connections are deny-by-default (persona.ToolFilter ConnectionRules), so util is reachable only by personas whose connection rules allow it — the built-in admin persona's "*", or an explicit operator grant. There is no separate access flag: not granting the connection is the restriction.

Index

Constants

View Source
const (
	// ConnectionName is exported for the reload bus, which must not treat
	// a connection the platform registers itself as one deleted from the
	// store (#1902).
	ConnectionName = "util"
)

Built-in identifiers. The connection name doubles as the catalog ID and is what a caller passes as the `connection` argument to the api gateway tools.

Variables

This section is empty.

Functions

func Register

func Register(d Deps) error

Register wires the in-process handler onto the toolkit and schedules the idempotent catalog + connection seed. The handler is built eagerly so a bad allow_private_cidrs entry fails registration (and is logged by the caller) instead of surfacing on the first fetch. Seed failures at start are non-fatal: they are logged and the next boot retries, mirroring the platform-admin self-connection.

Types

type Deps

type Deps struct {
	Toolkit  *apigatewaykit.Toolkit
	Catalog  catalog.Store
	Enqueuer Enqueuer
	// OnStart registers the seed with the platform lifecycle (late
	// registration runs immediately, matching the platform-admin
	// self-connection's boot ordering).
	OnStart func(func(context.Context) error)
	// AllowPrivateCIDRs is the operator's exemption list for the
	// fetch handler's internal-range block
	// (apigateway.util_connection.allow_private_cidrs).
	AllowPrivateCIDRs []string
}

Deps carries the seed's dependencies, gathered by pkg/platform's runtime wiring. All fields except Enqueuer and AllowPrivateCIDRs are required.

type Enqueuer

type Enqueuer interface {
	Enqueue(ctx context.Context, key catalogindex.SpecKey, kind catalogindex.Kind) (bool, error)
}

Enqueuer is the minimal slice of the api-catalog embed-jobs store the seed needs: enqueue an index job for one spec. Narrowed to an interface so the seed is testable without a live Postgres-backed queue. nil skips embedding (ranking falls back to lexical, the documented degraded mode).

Jump to

Keyboard shortcuts

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