api

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package opts holds shared configuration types for func-e options. This is internal and not intended for direct use by external packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminClient added in v1.3.0

type AdminClient interface {
	// Port returns the Envoy admin API port.
	Port() int

	// Do executes a request using the client configured for this AdminClient.
	Do(req *http.Request) (*http.Response, error)

	// Get returns the content at the given path or an error if != 200
	Get(ctx context.Context, path string) ([]byte, error)

	// IsReady returns nil if Envoy is ready to accept requests, or an error otherwise.
	//
	// This is a convenience form of Get on the /ready endpoint.
	IsReady(ctx context.Context) error

	// AwaitReady polls IsReady until it succeeds or the context is canceled.
	// On timeout/cancellation, returns the last error from IsReady if available,
	// otherwise returns the context error.
	AwaitReady(ctx context.Context, tickDuration time.Duration) error

	// NewListenerRequest creates an HTTP request against a named listener.
	// Similar to http.NewRequestWithContext, but targets the specified listener (e.g., "main").
	// The path parameter should include the path, query, and fragment (e.g., "/path?query#fragment").
	NewListenerRequest(ctx context.Context, name, method, path string, body io.Reader) (*http.Request, error)
}

AdminClient provides methods to interact with Envoy's admin API.

This is typically created via envoy.NewAdminClient, which polls for the admin port and PID from the run directory.

type HTTPTransport added in v1.5.0

type HTTPTransport func() http.RoundTripper

HTTPTransport creates the HTTP client transport used during a run.

type RunMiddlewareKey added in v1.3.0

type RunMiddlewareKey struct{}

RunMiddlewareKey is a context.Context Value key. Its associated value should be a RunMiddleware.

type RunOpts added in v1.3.0

type RunOpts struct {
	ConfigHome       string
	DataHome         string
	StateHome        string
	RuntimeDir       string
	RunID            string // Optional: custom run identifier for StateDir and RuntimeDir paths
	EnvoyVersion     string
	EnvoyVersionsURL string
	Out              io.Writer
	EnvoyOut         io.Writer
	EnvoyErr         io.Writer
	HTTPTransport    http.RoundTripper
	EnvoyPath        string      // Path to a custom Envoy binary, bypassing download.
	StartupHook      StartupHook // Experimental: custom startup hook
}

RunOpts holds the configuration set by RunOptions.

type StartupHook added in v1.3.0

type StartupHook func(ctx context.Context, adminClient AdminClient, runID string) error

StartupHook runs once the Envoy admin server is ready.

The hook receives the AdminClient and runID. The runID is unique to this run and can be used to construct file paths as needed.

Note: Startup hooks are considered mandatory and will stop the run with error if failed. If your hook is optional, rescue panics and log your own errors.

Jump to

Keyboard shortcuts

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