envoy

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proxy

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

Proxy manages an Envoy proxy process.

TODO(NET-118): properly handle the Envoy process lifecycle, including restarting crashed processes.

func NewProxy

func NewProxy(cfg ProxyConfig) (*Proxy, error)

NewProxy creates a Proxy with the given configuration.

Use Run to start the Envoy proxy process.

func (*Proxy) Exited

func (p *Proxy) Exited() chan struct{}

Exited returns a channel that is closed when the Envoy process exits. It can be used to detect and act on process crashes.

func (*Proxy) Run

func (p *Proxy) Run(ctx context.Context) error

Run the Envoy proxy process.

The caller is responsible for terminating the Envoy process with Stop. If it crashes the caller can be notified by receiving on the Exited channel.

Run may only be called once. It is not possible to restart a stopped proxy.

func (*Proxy) Stop

func (p *Proxy) Stop() error

Stop the Envoy proxy process.

Note: the caller is responsible for ensuring Stop is not called concurrently with Run, as this is thread-unsafe.

type ProxyConfig

type ProxyConfig struct {
	// ExecutablePath is the path to the Envoy executable.
	//
	// Defaults to whichever executable called envoy is found on $PATH.
	ExecutablePath string

	// ExtraArgs are additional arguments that will be passed to Envoy.
	ExtraArgs []string

	// Logger that will be used to emit log messages.
	//
	// Note: Envoy logs are *not* written to this logger, and instead are written
	// directly to EnvoyOutputStream + EnvoyErrorStream.
	Logger hclog.Logger

	// LogJSON determines whether the logs emitted by Envoy will be in JSON format.
	LogJSON bool

	// EnvoyErrorStream is the io.Writer to which the Envoy output stream will be redirected.
	// Envoy writes process debug logs to the error stream.
	EnvoyErrorStream io.Writer

	// EnvoyOutputStream is the io.Writer to which the Envoy output stream will be redirected.
	// The default Consul access log configuration write logs to the output stream.
	EnvoyOutputStream io.Writer

	// BootstrapConfig is the Envoy bootstrap configuration (in YAML or JSON format)
	// that will be provided to Envoy via the --config-path flag.
	BootstrapConfig []byte
}

ProxyConfig contains the configuration required to run an Envoy proxy.

Jump to

Keyboard shortcuts

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