support

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package support holds helpers shared by the default HTTP and MCP client implementations: option identity, header canonicalization, endpoint validation, limit resolution and the hardened transport factory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalHeaders

func CanonicalHeaders(source map[string]string) (map[string]string, error)

CanonicalHeaders canonicalizes static header names and rejects duplicates.

func Identity

func Identity(options any) (string, error)

Identity digests the complete typed options so clients are scoped by configuration, never by caller.

func Limits

func Limits(limits client.Limits) (time.Duration, int64, error)

Limits validates explicit bounds. Omitted and zero values mean unlimited.

func NewBoundedTransportClient

func NewBoundedTransportClient(limit int64) *http.Client

NewBoundedTransportClient applies a limit to each HTTP response body before a protocol decoder can buffer it. Streaming responses share the limit across their complete body; the limit is not reset for individual Read calls.

func NewTransportClient

func NewTransportClient() *http.Client

NewTransportClient keeps default TLS verification and never follows redirects, so forwarded headers cannot leak to a redirect target.

func ValidateEndpointURL

func ValidateEndpointURL(raw string) (*url.URL, error)

ValidateEndpointURL accepts absolute http/https URLs with a host and without embedded user information.

func WithResponseLimitFailure

func WithResponseLimitFailure(ctx context.Context, fail func(error)) context.Context

WithResponseLimitFailure lets a protocol wait be canceled with the read failure when its transport does not propagate streaming body errors itself.

func WithTimeout

func WithTimeout(ctx context.Context, timeout time.Duration) (context.Context, context.CancelFunc)

WithTimeout preserves caller cancellation without imposing a deadline at zero.

Types

This section is empty.

Jump to

Keyboard shortcuts

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