admin

package
v0.44.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package admin implements the holt hub's Admin gRPC service over a *registry.Registry: list live tunnels, force one closed, and — when a Blocker is supplied — ban/unban a peer id. Mount the returned connect handler behind whatever operator auth you use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockedPeer

type BlockedPeer = blocklist.BlockedPeer

BlockedPeer is one entry in the peer-id denylist.

type Blocker

type Blocker interface {
	Block(peer string)
	Unblock(peer string)
	Blocked() []BlockedPeer
}

Blocker is the hub-side peer-id denylist BlockPeer/UnblockPeer drive, and ListBlocked reads. The ban is on the identity, not one token. The holt library has no notion of credentials, so the application supplies this (e.g. a JWT-subject blocklist the auth middleware consults). Optional — without it, BlockPeer/UnblockPeer return Unimplemented and ListBlocked is empty.

type HubInfo

type HubInfo struct {
	Version       string
	Commit        string
	AdvertiseAddr string
	ProxyAddr     string
	RouteHeader   string
	MetricsAddr   string // empty when metrics are off
	ExternalURL   string
	TokenTTL      time.Duration
	// ProxyRouting is how the proxy picks the target peer: "header",
	// "subdomain", or "both". ProxyDomain is the base domain the
	// subdomain strategies match (<peer>.<domain>), empty when
	// subdomain routing is off.
	ProxyRouting string
	ProxyDomain  string
}

HubInfo is the static hub metadata Info reports alongside the live counts. The library has no notion of these (build, listener addresses), so the application supplies them.

type Option

type Option func(*Service)

Option configures a Service.

func WithBlocker

func WithBlocker(b Blocker) Option

WithBlocker enables BlockPeer/UnblockPeer, wiring them to the given credential denylist.

func WithInfo

func WithInfo(i HubInfo) Option

WithInfo supplies the static metadata Info reports.

func WithRequests added in v0.37.0

func WithRequests(b *reqlog.Broker) Option

WithRequests enables WatchRequests, streaming from the broker the proxy publishes into. Without it the RPC is Unimplemented.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements holtv1connect.AdminHandler against a Registry.

func NewService

func NewService(registry *registry.Registry, opts ...Option) *Service

NewService wires the Admin service to a Registry.

func (*Service) BlockPeer

BlockPeer blocks a peer's credential and closes its live tunnel with a token-revoked GoAway.

func (*Service) Info

Info reports a snapshot of the hub: the static metadata supplied via WithInfo, plus the live tunnel and blocked counts.

func (*Service) ListBlocked

ListBlocked returns the currently-blocked peers, or an empty list when no blocker is configured.

func (*Service) WatchRequests added in v0.37.0

WatchRequests streams what the proxy carried, as each response completes: the few events the broker still holds, then live ones. A request naming a peer gets only that peer's, filtered here. Without a Requests broker the hub carries no such view, which is Unimplemented rather than a stream that never sends. Returns when the client goes away.

func (*Service) WatchTunnels

WatchTunnels streams the live-tunnel set: a snapshot of the current tunnels as ATTACHED events, then live attach/detach transitions. The subscription is opened before the snapshot is read, so nothing falls in the gap; the overlap can produce a duplicate ATTACHED, which clients must treat as idempotent. Returns when the client goes away or the registry drops this watcher for being too slow (the client resubscribes and gets a fresh snapshot).

Jump to

Keyboard shortcuts

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