proxy

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package proxy implements the LLM gateway localhost reverse proxy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v0.26.1

type Option func(*Proxy)

Option configures optional Proxy behaviour.

func WithTLSSkipVerify added in v0.26.1

func WithTLSSkipVerify(skip bool) Option

WithTLSSkipVerify disables TLS certificate verification for the upstream gateway connection. This is intended for local development only (e.g., self-signed certificates). It must NOT be used in production.

type Proxy

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

Proxy is a localhost reverse proxy that strips incoming Authorization headers and injects fresh OIDC tokens before forwarding to the LLM gateway.

func New

func New(cfg *llm.Config, ts TokenSource, opts ...Option) (*Proxy, error)

New creates a Proxy and binds the TCP listener immediately so that Addr() returns the correct address before Start is called. Returns an error if GatewayURL is unparsable, the listen address is not loopback, or the port is already in use.

func (*Proxy) Addr

func (p *Proxy) Addr() string

Addr returns the actual bound listen address (e.g. "127.0.0.1:14000").

func (*Proxy) Start

func (p *Proxy) Start(ctx context.Context) error

Start begins serving using the listener bound in New. It blocks until ctx is cancelled, then performs a graceful shutdown with a 5-second timeout.

type TokenSource

type TokenSource interface {
	Token(ctx context.Context) (string, error)
}

TokenSource obtains fresh OIDC access tokens for the LLM gateway. *llm.TokenSource satisfies this interface.

Jump to

Keyboard shortcuts

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