translator

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: Apache-2.0 Imports: 133 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthorityHeaderKey = ":authority"
)
View Source
const (
	ConnectProtocol = "CONNECT"
)

Variables

View Source
var EnvoyJSONLogFields = map[string]string{
	"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%",
}

Functions

func BuildRateLimitServiceConfig added in v0.3.0

func BuildRateLimitServiceConfig(irListeners []*ir.HTTPListener) []*rlsconfv3.RateLimitConfig

BuildRateLimitServiceConfig builds the rate limit service configurations based on https://github.com/envoyproxy/ratelimit#the-configuration-format It returns a list of unique configurations, one for each domain needed across all listeners. For shared rate limits, it ensures we only process each shared domain once to improve efficiency.

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
	EndpointTypeDynamicResolver
)
const (
	DefaultEndpointType EndpointType = iota
	Static
	EDS
)

type ExtraArgs added in v1.2.0

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

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 HTTPRouteTranslator added in v1.2.0

type HTTPRouteTranslator struct {
	*ir.HTTPRoute
}

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 TCPRouteTranslator added in v1.2.0

type TCPRouteTranslator struct {
	*ir.TCPRoute
}

type Translator added in v0.3.0

type Translator struct {
	// ControllerNamespace is the namespace of the Gateway API controller
	ControllerNamespace string

	// 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

	// FilterOrder holds the custom order of the HTTP filters
	FilterOrder []egv1a1.FilterPosition

	// RuntimeFlag holds the feature flags for the translator.
	RuntimeFlags *egv1a1.RuntimeFlags

	Logger logging.Logger
}

Translator translates the xDS IR into xDS resources.

func (*Translator) Translate added in v0.3.0

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

Translate translates the XDS IR into xDS resources

type UDPRouteTranslator added in v1.2.0

type UDPRouteTranslator struct {
	*ir.UDPRoute
}

Jump to

Keyboard shortcuts

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