server

package
v0.14.14 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 15 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 WithInboundAuthToken added in v0.14.0

func WithInboundAuthToken(token string) Option

WithInboundAuthToken requires this bearer or x-api-key token on every route except health and readiness probes. Empty keeps the public server behavior.

func WithPolicyRoutingAllowRemoteSingleTenant added in v0.14.0

func WithPolicyRoutingAllowRemoteSingleTenant(allow bool) Option

WithPolicyRoutingAllowRemoteSingleTenant acknowledges that a policy-routing server bound beyond loopback is operated as a trusted single-tenant service.

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 configured listen address, except that a server configured with port 0 reports the actual bound address after Start succeeds.

func (*Server) Done added in v0.14.0

func (s *Server) Done() <-chan error

Done reports the terminal Serve result. It yields nil after a normal shutdown and a non-nil error when the listener stops unexpectedly.

func (*Server) DynamicProviderValidationPending added in v0.14.1

func (s *Server) DynamicProviderValidationPending() bool

DynamicProviderValidationPending reports whether deferred discovery remains.

func (*Server) InitializePolicyRouting added in v0.14.0

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

InitializePolicyRouting performs any configured policy-routing preflight.

func (*Server) IsRunning

func (s *Server) IsRunning() bool

IsRunning returns whether the server is currently running.

func (*Server) MessagesAliasResolvesTo added in v0.14.14

func (s *Server) MessagesAliasResolvesTo(ctx context.Context, alias, model string) bool

MessagesAliasResolvesTo reports whether a Messages request naming alias is served like one naming model.

func (*Server) ModelUsesCopilot added in v0.14.0

func (s *Server) ModelUsesCopilot(model string) bool

ModelUsesCopilot reports whether launcher startup needs Copilot authentication to resolve or collision-check model.

func (*Server) SetStartupAuthenticationPending added in v0.13.0

func (s *Server) SetStartupAuthenticationPending(pending bool)

SetStartupAuthenticationPending gates non-health routes while startup auth is in progress.

func (*Server) Start

func (s *Server) Start() error

Start begins listening in a goroutine. It returns an error if the listener cannot be established and shuts down that generation. A concurrent Stop retains its deadline and background-finalization semantics. Create a new Server to retry after a failed start or shutdown.

func (*Server) Stop

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

Stop performs a graceful shutdown of the server.

func (*Server) UsesCopilot added in v0.14.1

func (s *Server) UsesCopilot() bool

UsesCopilot reports whether the active serve scope needs Copilot auth.

func (*Server) ValidateDynamicProviderModels added in v0.13.0

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

ValidateDynamicProviderModels loads deferred dynamic provider catalogs.

Jump to

Keyboard shortcuts

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