proxy

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyRules

func ApplyRules(rules []config.TransformRule, body []byte) ([]byte, map[string]string, error)

ApplyRules evaluates each transform rule against the request body and applies matching mutations. Returns the (possibly modified) body, any extra headers to add to the upstream request, and an error if JSON handling fails.

Types

type Proxy

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

Proxy is a local HTTP server that forwards Anthropic API requests to a provider.

func NewProxy

func NewProxy(providerURL, authToken, oauthToken string, rules []config.TransformRule) *Proxy

NewProxy creates a new proxy that forwards requests to providerURL.

func (*Proxy) Shutdown

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

Shutdown gracefully stops the proxy server.

func (*Proxy) Start

func (p *Proxy) Start() (int, error)

Start binds to a random port on localhost and begins serving. Returns the port number the proxy is listening on.

Jump to

Keyboard shortcuts

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