server

package
v0.12.0 Latest Latest
Warning

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

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

Documentation

Overview

Package server serves Racer HTTPS endpoints from locally validated authority.

Index

Constants

View Source
const ReplicationPath = "/internal/v1/snapshot"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ControlAddress        string
	TLSCertificateFile    string
	TLSPrivateKeyFile     string
	ReplicationServerName string
	Limits                Limits
}

Config contains only the HTTPS serving inputs, copied by New.

func (Config) Validate

func (c Config) Validate() error

Validate preserves controller validation: listener paths are checked by Start, and the replication client validates its server name before manager startup.

type Leader

type Leader interface {
	LeaderContext() (context.Context, bool)
	PollInterval() time.Duration
	AuthenticateReplica(context.Context, *http.Request) (string, time.Time, error)
}

Leader is the publisher view needed by the internal replication endpoint.

type Lifecycle

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

Lifecycle owns process serving, independently of the leader-owned publishers.

func NewLifecycle

func NewLifecycle(a *authority.Authority) *Lifecycle

func (*Lifecycle) NeedLeaderElection

func (*Lifecycle) NeedLeaderElection() bool

func (*Lifecycle) ProcessContext

func (l *Lifecycle) ProcessContext(parent context.Context) (context.Context, context.CancelFunc)

ProcessContext binds a request to the serving process lifetime. Missing or canceled process lifetime returns an already-canceled child.

func (*Lifecycle) Ready

func (l *Lifecycle) Ready(_ *http.Request) error

func (*Lifecycle) SetCacheSync

func (l *Lifecycle) SetCacheSync(wait func(context.Context) bool)

SetCacheSync supplies the cache barrier before Start is called.

func (*Lifecycle) SetServingReady

func (l *Lifecycle) SetServingReady(ready bool)

SetServingReady is set only after the authenticated listener is accepting.

func (*Lifecycle) Start

func (l *Lifecycle) Start(ctx context.Context) error

type Limits

type Limits struct {
	MaxConnections          int
	MaxConcurrentHandshakes int
	MaxPolls                int
	MaxConcurrentWrites     int
	MaxConcurrentBootstrap  int
	HeaderBytes             int
	HandshakeTimeout        time.Duration
	WriteTimeout            time.Duration
	ShutdownTimeout         time.Duration
}

type Server

type Server struct {
	Lifecycle *Lifecycle
	Leader    Leader
	// contains filtered or unexported fields
}

func New

func New(cfg Config, writer client.Writer, auth *authority.Authority, lifecycle *Lifecycle, leader Leader) *Server

New composes serving dependencies without starting work or granting readiness.

func (*Server) Handler

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

Handler uses exact paths/methods without ServeMux redirects or implicit HEAD.

func (*Server) NeedLeaderElection

func (*Server) NeedLeaderElection() bool

func (*Server) Ready

func (s *Server) Ready(r *http.Request) error

func (*Server) Start

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

Start opens TLS before public readiness so controller replication cannot deadlock on bootstrap. Process cancellation closes connections and polls.

func (*Server) TLSConfig

func (s *Server) TLSConfig(ctx context.Context) (*tls.Config, error)

TLSConfig must use VerifyClientCertIfGiven: bootstrap can omit the client certificate, while snapshot explicitly requires VerifiedChains. Resumption and pooled requests must not extend certificate validity or stale trust. The caller owns the reload lifetime and must supply and cancel a cancelable context, including when listener setup fails. Start owns this context itself.

Jump to

Keyboard shortcuts

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