translator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 78 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddOperation     = "add"
	RemoveOperation  = "remove"
	ReplaceOperation = "replace"
	CopyOperation    = "copy"
	MoveOperation    = "move"
	EmptyPath        = ""
)
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 added in v0.3.0

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 added in v0.3.0

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

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

Types

type EndpointType added in v0.4.0

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

type GlobalRateLimitSettings added in v0.3.0

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 added in v0.6.0

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

type OrderedHTTPFilters added in v0.6.0

type OrderedHTTPFilters []*OrderedHTTPFilter

func (OrderedHTTPFilters) Len added in v0.6.0

func (o OrderedHTTPFilters) Len() int

func (OrderedHTTPFilters) Less added in v0.6.0

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

func (OrderedHTTPFilters) Swap added in v0.6.0

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

type Translator added in v0.3.0

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

	// ExtensionManager holds the config for interacting with extensions when generating xDS
	// resources. Only required during xds translation.
	ExtensionManager *extensionTypes.Manager
}

Translator translates the xDS IR into xDS resources.

func (*Translator) Translate added in v0.3.0

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