gateway

package
v2.0.0-beta.12 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 12 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 gateway is the host's public endpoint of a restored engine: a TCP listener that forwards the inference routes, and only those, to the agent's inference socket. Until the restore has passed its checks every request gets 503, so a client never waits on a half-restored engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, l net.Listener, g *Gateway, grace time.Duration) error

Serve runs the gateway on l until ctx ends, then drains for up to grace.

Types

type Gateway

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

Gateway forwards inference requests once ready.

func New

func New(socket string, onToken func()) *Gateway

New forwards to the engine behind socket; onToken runs once, when the first completion bytes go out.

func (*Gateway) Drain

func (g *Gateway) Drain(ctx context.Context) error

Drain closes admission and waits for the admitted requests, streaming bodies included.

func (*Gateway) ServeHTTP

func (g *Gateway) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP admits the inference routes, answers /health from readiness and refuses the management routes (sleep, wake, collective RPC).

func (*Gateway) SetReady

func (g *Gateway) SetReady(ready bool)

SetReady opens or closes admission.

type TLS

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

TLS is the gateway's certificate, read from PEM files and read again when they change: Kubernetes rotates a mounted secret by swapping a symlink, and the next handshake gets the new pair without a restart.

func LoadTLS

func LoadTLS(certFile, keyFile string) (*TLS, error)

LoadTLS reads the pair once, so that a bad certificate fails the start rather than every handshake.

func (*TLS) Listen

func (t *TLS) Listen(l net.Listener) net.Listener

Listen wraps l to serve TLS 1.2 or later over HTTP/1.1, or returns l as it is when t is nil.

func (*TLS) URL

func (t *TLS) URL(addr net.Addr) string

URL is the gateway's address as a client reaches it.

Jump to

Keyboard shortcuts

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