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
// 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 cancelled.
// 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 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
EnvoyPath string // Internal: path to the Envoy binary (for tests).
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.