server

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option customizes server creation.

func WithCompactUpstreamChunkBytes added in v0.10.3

func WithCompactUpstreamChunkBytes(bytes int) Option

WithCompactUpstreamChunkBytes overrides the initial body size targeted when chunking /v1/responses/compact retries after an upstream 413.

func WithCompactUpstreamChunkConcurrency added in v0.11.0

func WithCompactUpstreamChunkConcurrency(concurrency int) Option

WithCompactUpstreamChunkConcurrency overrides the maximum number of sibling compact chunks sent concurrently after the first chunk succeeds.

func WithCompactUpstreamMaxAttempts added in v0.10.3

func WithCompactUpstreamMaxAttempts(max int) Option

WithCompactUpstreamMaxAttempts caps the total logical compaction calls the /v1/responses/compact 413 fallback may perform per inbound request. Logical calls can produce extra real upstream POSTs through model fallback or the shared transport-retry policy.

func WithCopilotHeaderConfig

func WithCopilotHeaderConfig(cfg proxy.CopilotHeaderConfig) Option

WithCopilotHeaderConfig overrides the synthetic Copilot-identifying headers sent on upstream requests.

func WithProxyOptions

func WithProxyOptions(opts ...proxy.Option) Option

WithProxyOptions forwards proxy-level options to the underlying handler.

func WithResponsesWebSocketConfig

func WithResponsesWebSocketConfig(cfg proxy.ResponsesWebSocketConfig) Option

WithResponsesWebSocketConfig overrides websocket-session handling for GET /v1/responses Codex clients.

func WithStreamingUpstreamTimeout

func WithStreamingUpstreamTimeout(timeout time.Duration) Option

WithStreamingUpstreamTimeout overrides the timeout used for streaming upstream inference requests and derives the server write timeout from it.

type Server

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

Server encapsulates the HTTP server lifecycle.

func New

func New(authenticator *auth.Authenticator, log *logger.Logger, host, port string, opts ...Option) (*Server, error)

New creates a Server with routes and timeouts configured.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the listen address.

func (*Server) IsRunning

func (s *Server) IsRunning() bool

IsRunning returns whether the server is currently running.

func (*Server) Start

func (s *Server) Start() error

Start begins listening in a goroutine. It returns an error if the listener cannot be established.

func (*Server) Stop

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

Stop performs a graceful shutdown of the server.

Jump to

Keyboard shortcuts

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