proxy

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package proxy implements the drop-in HTTP proxy mode:

squoze proxy --port 8787 --upstream https://api.anthropic.com

Contract: squoze never breaks a request. If the engine panics or the body is unreadable, the original bytes go upstream unchanged (fail-open).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(upstream *url.URL) http.Handler

New returns an http.Handler that optimizes request bodies and forwards everything else verbatim to upstream, using the default engine.

Types

type Server

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

Server is the squoze HTTP proxy bound to one engine instance.

func NewWithEngine

func NewWithEngine(upstream *url.URL, eng *engine.Engine) *Server

NewWithEngine binds the proxy to a specific engine (memo + originals shared across requests). A nil engine selects the package default. A nil upstream enables header-only routing: every request MUST carry X-Squoze-Upstream or gets a 502 (used by `sq <config-agent>` where each provider carries its own original endpoint).

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the proxy pipeline.

func (*Server) WithLog added in v0.1.2

func (s *Server) WithLog(w io.Writer) *Server

WithLog attaches a request log sink (JSONL, one object per request).

Jump to

Keyboard shortcuts

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