proxy

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: AGPL-3.0 Imports: 19 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 proxy wires relaykit's conversion kernel to HTTP.

The data path is deliberately one-directional and stateless:

client protocol  --decode-->  DTO  --relaykit-->  DTO  --encode-->  upstream
upstream protocol <--encode-- DTO <--relaykit--  DTO <--decode--  client

relaykit owns every semantic decision between the two DTO hops. This package owns transport only: HTTP framing, headers, SSE, and error shapes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpstreamAuthHeaders

func UpstreamAuthHeaders(format types.RelayFormat, apiKey string) map[string]string

UpstreamAuthHeaders returns the authentication headers a protocol expects. Exported so the admin UI's connectivity probe authenticates exactly the way live traffic does, rather than reimplementing the rules.

Types

type Event

type Event struct {
	Seq              uint64 `json:"seq"`
	Time             string `json:"time"`
	Client           string `json:"client"`
	Upstream         string `json:"upstream"`
	Model            string `json:"model"`
	UpstreamModel    string `json:"upstream_model,omitempty"`
	Stream           bool   `json:"stream"`
	Status           int    `json:"status"`
	LatencyMS        int64  `json:"latency_ms"`
	Converter        string `json:"converter,omitempty"`
	Diagnostics      int    `json:"diagnostics"`
	PromptTokens     int    `json:"prompt_tokens"`
	CompletionTokens int    `json:"completion_tokens"`
	Error            string `json:"error,omitempty"`
}

Event is one completed conversion, as shown in the admin UI.

type Proxy

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

Proxy converts and forwards one client protocol to one upstream protocol.

The upstream is swappable at runtime: Apply publishes a new runtime snapshot atomically, so an operator can retarget the converter from the admin UI without dropping in-flight streams.

func New

func New(store *config.Store) (*Proxy, error)

func (*Proxy) Apply

func (p *Proxy) Apply(cfg *config.Config) error

Apply publishes cfg as the live upstream. The previous runtime's idle connections are released once it is no longer reachable.

func (*Proxy) EventsSince

func (p *Proxy) EventsSince(seq uint64) []Event

EventsSince returns the conversion history newer than seq, for the console.

func (*Proxy) EventsTotal

func (p *Proxy) EventsTotal() uint64

EventsTotal is the number of conversions observed since start.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves one client request in any supported protocol.

func (*Proxy) Store

func (p *Proxy) Store() *config.Store

Store exposes the live configuration.

Jump to

Keyboard shortcuts

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