server

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 38 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

Index

Constants

View Source
const (
	HealthPath = "/healthz"
	LivePath   = "/livez"
)

Routes of the server that tell whether icebath is well, which ask no password: a container's health check and an orchestrator ask them. The first says whether the server serves and every service it wants up is up and ready, the second whether it serves at all

View Source
const (
	ProfileHeader = "Icebath-Profile"
	WindowHeader  = "Icebath-Window"
	YoloHeader    = "Icebath-Yolo"
)

Request headers carrying the window's profile, its id, and whether its sessions run without asking

View Source
const FolderHeader = "Icebath-Folder"

Header of the answers of health naming the settings folder the server serves, as Folder names it

View Source
const LanguageHeader = "Icebath-Language"

Header a window names the language it speaks in, on every request of its connection

View Source
const StayRoot = "ICEBATH_DOCKER_EXEC_AS_ROOT"

Variable that keeps a process started as root in the container image of icebath root, rather than becoming the account of the image, such as for one command run with docker exec

Variables

This section is empty.

Functions

func Folder

func Folder(dir string) string

Short name of a settings folder that tells two folders apart without saying their path: the start of the digest of the folder with its links followed

func Own

func Own(ctx context.Context) bool

Whether the request came through this process's own connection rather than over the network

func Profile

func Profile(ctx context.Context, cfg *config.Config, name string) (*config.Config, error)

Settings of the profile a request names; when it names none, the one its window is on, else the one the process started on. A profile that is not there is not found

func Refuse

func Refuse(code connect.Code, err error) *connect.Error

A refusal whose message is the error's, which the request's language says where the error holds messages: what a handler returns for an error a person reads

func Remote

func Remote(ctx context.Context) bool

Whether the request came over the network from another process

func Routed

func Routed(ctx context.Context) *config.Config

Settings of the profile a request of the HTTP API names, which keyed checked the key of; nil for any other request

func Window

func Window(ctx context.Context) string

Profile the window a request came from is on, empty for a caller that names none

func WindowID

func WindowID(ctx context.Context) string

Id of the window a request came from, empty when it names none

func Yolo

func Yolo(ctx context.Context) bool

Whether the window the request came from runs its sessions without asking

Types

type Account

type Account struct {
	Name     string
	UID, GID int
	// Groups it is a member of besides its own, by id
	Groups []int
	// Its home folder and login shell, as /etc/passwd of the image gives them
	Home, Shell string
	// Folder only it may use while it runs, its XDG_RUNTIME_DIR; empty for none
	Runtime string
}

Who a process started as root in the container image of icebath becomes before it serves: the account of the image, as its start left it

func (Account) Named

func (a Account) Named() bool

Whether the account is one, rather than the zero account of a process that becomes no one

type Health

type Health struct {
	// Address it serves at and since when, empty while it does not serve
	At    string
	Since time.Time
	// What of it is not well, none when everything is
	Problems []Problem
	// What it tells beside, none when nothing
	Remarks []Remark
}

How well this icebath is

func (Health) Well

func (h Health) Well() bool

It serves and nothing of it is unwell

type Keeper

type Keeper interface {
	// What it keeps going that is not well in this icebath now, none when everything is
	Unwell(ctx context.Context) []Problem
}

Registrant that keeps something going whose standing the health of icebath counts, such as the services of the runner

type Limits

type Limits struct {
	// Files and connections the process may hold open at once, and the most it may raise that to; -1 where the system sets no bound or
	// says none, as Windows
	Files, FilesMost int64
	// Files Open files asks for, zero for none, and those the process started with
	FilesAsked, FilesBefore int64
	// Why the files could not be raised to what was asked, in a sentence; empty when they were or nothing was asked
	FilesWhy string
	// The process holds the allocator of glibc, which the C code it runs takes its memory from, and the most arenas that allocator makes as
	// it was capped, zero where it was not
	Glibc  bool
	Arenas int
	// What gave the cap: the setting, or MALLOC_ARENA_MAX
	ArenasBy string
	// Why the arenas were not capped as asked, in a sentence; empty when they were or nothing was asked
	ArenasWhy string
}

What the system lets this process have of what Open files and Memory arenas ask, as Limit left it

type Notices

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

Notices by profile with a read mark per reader, so each window shows each notice once and a command never takes one from a window

func (*Notices) Masking

func (n *Notices) Masking(mask func(profile, text string) string)

Has every notice masked by mask as a reader takes it, as it leaves the process then: by the secrets of its profile, those of every profile for one told to all. mask is called holding no lock

func (*Notices) OnTell

func (n *Notices) OnTell(fn func(profile string))

Calls fn with the profile of each new notice

func (*Notices) Read

func (n *Notices) Read(profile, reader string) []string

Unread notices of the profile and of every profile, oldest first, marked read for the reader; an empty reader, such as a command, marks nothing

func (*Notices) Tell

func (n *Notices) Tell(profile, text string)

Adds a notice for the profile, or for every profile when it is empty; a duplicate still kept is skipped

func (*Notices) TellIn

func (n *Notices) TellIn(profile, text string)

Same as Tell, for features that take a teller with this method name

type Problem

type Problem struct {
	// What it is, by the name a person controls it by, and what a person calls it
	Name, Title string
	// Why it is not well, a sentence
	Why string
}

Something of icebath that is not well

type Registrant

type Registrant interface {
	Mount(services *connect.Server)
}

type Registry

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

func (*Registry) Close

func (r *Registry) Close() error

func (*Registry) Mount

func (r *Registry) Mount(services *connect.Server)

func (*Registry) Register

func (r *Registry) Register(registrant Registrant)

func (*Registry) Routes

func (r *Registry) Routes(mux *http.ServeMux, keyed func(http.Handler) http.Handler)

Adds what every registrant serves as plain HTTP to the mux

type Remark

type Remark struct {
	// What it is of, by a name of the code, and what a person calls it
	Name, Title string
	// What it says, a sentence
	Says string
}

Something of icebath its health tells beside whether it is well, such as a stop a person put in force on purpose, which leaves it well

type Remarker

type Remarker interface {
	// What it tells now, none when nothing
	Remarks(ctx context.Context) []Remark
}

Registrant that tells something of this icebath its health answer says beside whether it is well, such as the emergency stop

type Router

type Router interface {
	// Adds what it serves to the mux. Keyed wraps a handler so that it answers only a request that carries the API key of the profile
	// the request names, whose settings the handler reads with Routed
	Routes(mux *http.ServeMux, keyed func(http.Handler) http.Handler)
}

Registrant that serves plain HTTP beside the services, such as the API other programs speak to the agent in

type Server

type Server struct {
	Registry
	// The windows that reach this server, and what it has to tell the person on each profile
	Windows *Windows
	Notices *Notices
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config) *Server

func (*Server) Accepting

func (s *Server) Accepting(accept func(cfg *config.Config, accept string) *lang.Language)

Has each request of the HTTP API speak the language this gives for its profile and the languages it accepts

func (*Server) Adopt

func (s *Server) Adopt()

Takes up the processes orphaned below this server and reaps them as they end: the first process of its container does from its start, any other makes itself the reaper of its descendants where the system lets a process ask for them, on Linux

func (*Server) Became

func (s *Server) Became() Account

Account this process became as it started as root in the container image, the zero one for a process that became no one

func (*Server) Become

func (s *Server) Become(account Account) error

Makes this process the account for good, as one started as root in the container image: its groups, its gid and its uid set on every thread, real, effective and saved alike, after which the kernel leaves it no right of root; then the login environment of the account and a working folder it may enter. Verified on every thread before anything else of the process runs, and a process that could take root back ends at once. Nothing for the zero account

func (*Server) End

func (s *Server) End() error

Ends the processes left of this one once every feature stopped what it owns: the first process of a container every other process of it, a server below the init of a container the processes orphaned below it, each told to end and killed once Processes stop passed. Outside a container what it took up is handed on as it ends, as what icebath started there may be meant to outlive it

func (*Server) Health

func (s *Server) Health(ctx context.Context) Health

How well this icebath is now: whether it serves, and what every registrant that keeps something going says is not well

func (*Server) Limit

func (s *Server) Limit()

Asks the system once for what Open files and Memory arenas set, as the process starts and before the features open their stores: the files the process may hold open raised toward the setting, the most they may be with them where the process may raise that, as root may, and the arenas of the allocator of glibc capped. What came of it is kept for Limits, and what fell short is said in the log

func (*Server) Limits

func (s *Server) Limits() Limits

What the system lets this process have of what the settings ask, as Limit left it; the zero Limits before it ran

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

func (*Server) Services

func (s *Server) Services() *connect.Server

The services every feature registered, made the first time they are asked for and the same from then on; asked for only once every feature registered

func (*Server) Serving

func (s *Server) Serving() (string, time.Time)

Address this process serves at and since when; empty while it does not serve

func (*Server) Speaking

func (s *Server) Speaking(speak func(profile, named string) *lang.Language)

Has each request of a window speak the language this gives for the profile the window works on and the language it names

type Windows

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

Windows connected to this server. A window is live while a stream of it is open; another process's window stays live for twenty seconds after that, and this process's own window stays live while the process runs

func (*Windows) Attend

func (w *Windows) Attend(id string, own bool) (leave func())

Counts an open stream of the window until the returned leave is called; own marks a window of this process

func (*Windows) Live

func (w *Windows) Live(id string) bool

Whether the window is live

func (*Windows) OnGone

func (w *Windows) OnGone(fn func(id string))

Calls fn with the id of each window that goes away

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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