Help us shape the future of Go! Take the 2026 Go Developer Survey

proxy

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package proxy implements the HTTP-terminated, non-translating A2A Path A pipe. It governs HTTP headers and validates framing while preserving accepted JSON-RPC bodies and SSE records byte-for-byte.

Index

Constants

View Source
const (
	MaxBodyBytes   int64 = 4 << 20
	MaxEventBytes  int64 = 1 << 20
	MaxStreamBytes int64 = 64 << 20
	IdleTimeout          = 60 * time.Second
)

Variables

This section is empty.

Functions

func CopyHeaders

func CopyHeaders(dst, source http.Header)

CopyHeaders replaces dst with the governed upstream response headers.

func CopyStream

func CopyStream(dst io.Writer, src io.Reader, requestID []byte) error

CopyStream forwards validated SSE records and flushes after each record when dst implements http.Flusher.

func IsInvalidResponse

func IsInvalidResponse(err error) bool

Types

type InvalidResponseError

type InvalidResponseError struct{ Err error }

func (*InvalidResponseError) Error

func (e *InvalidResponseError) Error() string

func (*InvalidResponseError) Unwrap

func (e *InvalidResponseError) Unwrap() error

type Options

type Options struct {
	InterfaceURL string
	HTTPClient   *http.Client
	TotalTimeout time.Duration
	IdleTimeout  time.Duration
}

type Proxy

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

func New

func New(opts Options) (*Proxy, error)

func (*Proxy) Do

func (p *Proxy) Do(ctx context.Context, inbound *http.Request, body []byte, meta jsonrpc.InspectedRequest) (*Response, error)

Do forwards an already inspected request. The caller owns response closure.

type Response

type Response struct {
	Header    http.Header
	Body      io.ReadCloser
	Buffered  []byte
	Streaming bool
	// contains filtered or unexported fields
}

func (*Response) Close

func (r *Response) Close() error

Jump to

Keyboard shortcuts

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