translator

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: Apache-2.0 Imports: 80 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorityHeaderKey = ":authority"
View Source
const (
	// EnvoyTextLogFormat is the default log format for Envoy.
	// See https://www.envoyproxy.io/docs/envoy/latest/configuration/observability/access_log/usage#default-format-string
	EnvoyTextLogFormat = "{\"start_time\":\"%START_TIME%\",\"method\":\"%REQ(:METHOD)%\"," +
		"\"x-envoy-origin-path\":\"%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%\",\"protocol\":\"%PROTOCOL%\"," +
		"\"response_code\":\"%RESPONSE_CODE%\",\"response_flags\":\"%RESPONSE_FLAGS%\"," +
		"\"response_code_details\":\"%RESPONSE_CODE_DETAILS%\"," +
		"\"connection_termination_details\":\"%CONNECTION_TERMINATION_DETAILS%\"," +
		"\"upstream_transport_failure_reason\":\"%UPSTREAM_TRANSPORT_FAILURE_REASON%\"," +
		"\"bytes_received\":\"%BYTES_RECEIVED%\",\"bytes_sent\":\"%BYTES_SENT%\"," +
		"\"duration\":\"%DURATION%\",\"x-envoy-upstream-service-time\":\"%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%\"," +
		"\"x-forwarded-for\":\"%REQ(X-FORWARDED-FOR)%\",\"user-agent\":\"%REQ(USER-AGENT)%\"," +
		"\"x-request-id\":\"%REQ(X-REQUEST-ID)%\",\":authority\":\"%REQ(:AUTHORITY)%\"," +
		"\"upstream_host\":\"%UPSTREAM_HOST%\",\"upstream_cluster\":\"%UPSTREAM_CLUSTER%\"," +
		"\"upstream_local_address\":\"%UPSTREAM_LOCAL_ADDRESS%\"," +
		"\"downstream_local_address\":\"%DOWNSTREAM_LOCAL_ADDRESS%\"," +
		"\"downstream_remote_address\":\"%DOWNSTREAM_REMOTE_ADDRESS%\"," +
		"\"requested_server_name\":\"%REQUESTED_SERVER_NAME%\",\"route_name\":\"%ROUTE_NAME%\"}\n"
)

Variables

View Source
var (
	ErrXdsClusterExists = errors.New("xds cluster exists")
	ErrXdsSecretExists  = errors.New("xds secret exists")
)

Functions

func BuildRateLimitServiceConfig

func BuildRateLimitServiceConfig(irListener *ir.HTTPListener) *rlsconfv3.RateLimitConfig

BuildRateLimitServiceConfig builds the rate limit service configuration based on https://github.com/envoyproxy/ratelimit#the-configuration-format

func GetRateLimitServiceConfigStr

func GetRateLimitServiceConfigStr(pbCfg *rlsconfv3.RateLimitConfig) (string, error)

GetRateLimitServiceConfigStr returns the PB string for the rate limit service configuration.

Types

type EndpointType

type EndpointType int
const (
	EndpointTypeDNS EndpointType = iota
	EndpointTypeStatic
)
const (
	DefaultEndpointType EndpointType = iota
	Static
	EDS
)

type GlobalRateLimitSettings

type GlobalRateLimitSettings struct {
	// ServiceURL is the URL of the global
	// rate limit service.
	ServiceURL string

	// Timeout specifies the timeout period for the proxy to access the ratelimit server
	// If not set, timeout is 20000000(20ms).
	Timeout time.Duration

	// FailClosed is a switch used to control the flow of traffic
	// when the response from the ratelimit server cannot be obtained.
	FailClosed bool
}

type OrderedHTTPFilter

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

type OrderedHTTPFilters

type OrderedHTTPFilters []*OrderedHTTPFilter

func (OrderedHTTPFilters) Len

func (o OrderedHTTPFilters) Len() int

func (OrderedHTTPFilters) Less

func (o OrderedHTTPFilters) Less(i, j int) bool

func (OrderedHTTPFilters) Swap

func (o OrderedHTTPFilters) Swap(i, j int)

type Translator

type Translator struct {
	// GlobalRateLimit holds the global rate limit settings
	// required during xds translation.
	GlobalRateLimit *GlobalRateLimitSettings
}

Translator translates the xDS IR into xDS resources.

func (*Translator) Translate

func (t *Translator) Translate(ir *ir.Xds) (*types.ResourceVersionTable, error)

Translate translates the XDS IR into xDS resources

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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