server

package
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: AGPL-3.0 Imports: 39 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 server implements the relay's WebSocket server.

Sessions are owned by the Server and outlive any single connection: each session's output is delivered to its current "subscriber" connection. On a client reconnect, the relay advertises live sessions (`sessions`) and the client re-attaches (`attach`) — the relay re-issues a fresh session token, replays buffered output, and resumes streaming (protocol 1.1).

Index

Constants

View Source
const ContractVersion = "1.0"

ContractVersion is the /v1 contract's stability version. Within a major, the stable operation set and stable capabilities keep their meaning and only grow additively; a breaking change bumps this major AND the socket name (v1.sock → v2.sock), so an older client meets no socket rather than a changed contract.

View Source
const RelayVersion = "0.6.0" // v1.2: supervisor-tree parentage + subtree kill

RelayVersion is reported in the hello message.

Variables

This section is empty.

Functions

This section is empty.

Types

type Modern

type Modern struct {
	Store *journal.Store
	// contains filtered or unexported fields
}

Modern uses the legacy server's process registry. It owns durable observation and modern leases, never another process manager.

func (*Modern) BrowserObserver

func (m *Modern) BrowserObserver(w http.ResponseWriter, r *http.Request)

func (*Modern) BrowserRead

func (m *Modern) BrowserRead(w http.ResponseWriter, r *http.Request)

BrowserRead is deliberately a separate read-only doorway on the existing loopback listener. It never accepts the root operator token, and it never forwards a browser Origin to the private /v1 API.

func (*Modern) CleanShutdown

func (m *Modern) CleanShutdown() error

func (*Modern) CloseDirectories

func (m *Modern) CloseDirectories()

func (*Modern) ConfigureDirectories

func (m *Modern) ConfigureDirectories(paths []string) error

ConfigureDirectories is startup-only. Hold root descriptors for the daemon's lifetime: replacing a configured path must not silently widen authority.

func (*Modern) ServeHTTP

func (m *Modern) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Modern) StartWaits

func (m *Modern) StartWaits(state string, fetch waitFetch)

func (*Modern) StopWaits

func (m *Modern) StopWaits()

type Server

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

Server holds relay-wide state shared across connections.

func New

func New(cfg *config.Config) *Server

New builds a Server for the given config.

func (*Server) AdoptHolders

func (s *Server) AdoptHolders()

AdoptHolders re-attaches every block a previous daemon left under a holder and settles the ones whose child exited meanwhile. Called once at start, before any client can connect; each outcome is journaled explicitly.

func (*Server) BeginShutdown

func (s *Server) BeginShutdown()

BeginShutdown cancels pending handshakes and closes hijacked WebSockets, which net/http.Shutdown does not own. Established processes stop in StopAll.

func (*Server) Drain

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

func (*Server) EnableModern

func (s *Server) EnableModern(store *journal.Store, observer string) *Modern

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the relay's HTTP handler (a single WebSocket endpoint).

func (*Server) StopAll

func (s *Server) StopAll()

StopAll is used only for the foreground alpha daemon's explicit shutdown.

Jump to

Keyboard shortcuts

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