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

httprelay

package
v1.152.0 Latest Latest
Warning

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

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

Documentation

Overview

Package httprelay exposes a remote agent configuration through an HTTP handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler relays an agent configuration from a trusted HTTP endpoint.

func New

func New(source Source, opts ...Option) (*Handler, error)

New creates a configuration relay. Redirects are always refused so request credentials cannot be replayed to another endpoint.

func (*Handler) Serve

func (h *Handler) Serve(w http.ResponseWriter, r *http.Request) error

Serve fetches and returns the configuration. It writes a generic error to the client and returns the detailed cause for logging.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP fetches and returns the configuration.

type Option

type Option func(*Handler)

Option configures a Handler.

func WithClient

func WithClient(client *http.Client) Option

WithClient sets the outbound client. Its redirect policy is replaced with a no-redirect policy.

func WithMaxBytes

func WithMaxBytes(n int64) Option

WithMaxBytes sets the maximum accepted configuration size.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the end-to-end upstream request timeout.

type Source

type Source func(*http.Request) (*url.URL, error)

Source resolves the trusted upstream URL for a request. Implementations must not return unvalidated user input.

Jump to

Keyboard shortcuts

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