api

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 36 Imported by: 0

Documentation

Overview

Package api exposes the agent's HTTP API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddressBlock added in v0.1.2

func AddressBlock(ip string) string

AddressBlock groups source addresses for the login.fail budget and the connection cap: an IPv4 address (mapped in IPv6 or not), or the /64 of an IPv6 address (one host gets a whole /64). Anything else stays as is.

func ConfigureServer added in v0.1.2

func ConfigureServer(srv *http.Server)

ConfigureServer sets the delays of the agent's server. No WriteTimeout: it would cut the logs stream and long downloads, whose writes have their own deadlines.

func New

func New(d Deps) http.Handler

Types

type Deps

type Deps struct {
	Docker dockerx.Client
	// Views is the cache of the indexes of stopped containers; nil:
	// fsview.NewViews(Docker, fsview.DefaultOptions()).
	Views *fsview.Views
	// OpenFS opens the file view of a container by full ID; nil means
	// Views.For. API tests give an in-memory view.
	OpenFS       func(ctx context.Context, id string) (fsview.FS, error)
	Verifier     *auth.Verifier
	Sessions     *auth.Sessions
	Limiter      *auth.Limiter
	Audit        *audit.Log
	Version      string
	ReadOnly     bool
	TLS          bool
	PublicOrigin string       // normalized, or ""
	Static       http.Handler // embedded UI; nil in API tests
	ScriptHashes []string     // CSP sources of the UI's inline scripts (web.ScriptHashes)
	// Snapshots is the store of spec v0.2 §5.7 (snapshot.Unavailable when
	// refused at startup); nil: the snapshot routes answer internal.
	Snapshots *snapshot.Store
}

Jump to

Keyboard shortcuts

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