transport

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(p Provider)

Register registers a transport Provider. Later registrations override earlier ones. Typically called from init() via blank import.

Types

type Interceptor

type Interceptor interface {
	PreRoundTrip(req *http.Request) func(resp *http.Response, err error)
}

Interceptor defines network-layer customization via a pre/post hook pair. The built-in transport chain always executes between PreRoundTrip and the returned post function, and cannot be skipped or overridden by the extension.

PreRoundTrip is called before the built-in chain. Use it to add custom headers, rewrite the host, or start trace spans. Built-in decorators run after this and will override any same-named security headers set here. The extension must not replace req.Context() — the middleware restores the original context after PreRoundTrip returns.

The returned function (if non-nil) is called after the built-in chain completes. Use it for logging, ending trace spans, or recording metrics.

type Provider

type Provider interface {
	Name() string
	ResolveInterceptor(ctx context.Context) Interceptor
}

Provider creates Interceptor instances. Follows the same API style as extension/credential.Provider and extension/fileio.Provider.

func GetProvider

func GetProvider() Provider

GetProvider returns the currently registered Provider. Returns nil if no provider has been registered.

Jump to

Keyboard shortcuts

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