util

package
v0.0.0-...-edfa39e Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BlackHoleCluster to catch traffic from routes with unresolved clusters. Traffic arriving here goes nowhere.
	BlackHoleCluster = "BlackHoleCluster"
	// PassthroughCluster to forward traffic to the original destination requested. This cluster is used when
	// traffic does not match any listener in envoy.
	PassthroughCluster = "PassthroughCluster"
	// SniClusterFilter is the name of the sni_cluster envoy filter
	SniClusterFilter = "envoy.filters.network.sni_cluster"
)

Variables

View Source
var ALPNH2Only = []string{"h2"}

ALPNH2Only advertises that Proxy is going to use HTTP/2 when talking to the cluster.

View Source
var ALPNHttp = []string{"h2", "http/1.1"}

ALPNHttp advertises that Proxy is going to talking either http2 or http 1.1.

View Source
var ALPNInMesh = []string{"istio"}

ALPNInMesh advertises that Proxy is going to talk to the in-mesh cluster. The custom "istio" value indicates in-mesh traffic and it's going to be used for routing decisions.

View Source
var ALPNInMeshH2 = []string{"istio", "h2"}

ALPNInMeshH2 advertises that Proxy is going to use HTTP/2 when talking to the in-mesh cluster. The custom "istio" value indicates in-mesh traffic and it's going to be used for routing decisions. Once Envoy supports client-side ALPN negotiation, this should be {"istio", "h2", "http/1.1"}.

Functions

func BuildAddress

func BuildAddress(bind string, port uint32) core.Address

BuildAddress returns a SocketAddress with the given ip and port or uds.

func CloneCluster

func CloneCluster(cluster *xdsapi.Cluster) *xdsapi.Cluster

return a shallow copy cluster

func CloneLocalityLbEndpoints

func CloneLocalityLbEndpoints(endpoints []endpoint.LocalityLbEndpoints) []endpoint.LocalityLbEndpoints

return a shallow copy LocalityLbEndpoints

func ConvertAddressToCidr

func ConvertAddressToCidr(addr string) *core.CidrRange

ConvertAddressToCidr converts from string to CIDR proto

func ConvertLocality

func ConvertLocality(locality string) *core.Locality

ConvertLocality converts '/' separated locality string to Locality struct.

func GetByAddress

func GetByAddress(listeners []*xdsapi.Listener, addr string) *xdsapi.Listener

GetByAddress returns a listener by its address TODO(mostrowski): consider passing map around to save iteration.

func GetNetworkEndpointAddress

func GetNetworkEndpointAddress(n *model.NetworkEndpoint) core.Address

GetNetworkEndpointAddress returns an Envoy v2 API `Address` that represents this NetworkEndpoint

func GogoDurationToDuration

func GogoDurationToDuration(d *types.Duration) time.Duration

GogoDurationToDuration converts from gogo proto duration to time.duration

func IsProxyVersionGE11

func IsProxyVersionGE11(node *model.Proxy) bool

IsProxyVersionGE11 checks whether the given Proxy version is greater than or equals 1.1.

func LbPriority

func LbPriority(proxyLocality, endpointsLocality model.LocalityInterface) int

func LocalityLbWeightNormalize

func LocalityLbWeightNormalize(endpoints []endpoint.LocalityLbEndpoints) []endpoint.LocalityLbEndpoints

LocalityLbWeightNormalize set LocalityLbEndpoints within a cluster with a valid LoadBalancingWeight.

func LocalityMatch

func LocalityMatch(proxyLocality model.LocalityInterface, ruleLocality string) bool

func MessageToStruct

func MessageToStruct(msg proto.Message) *types.Struct

MessageToStruct converts from proto message to proto Struct

func ResolveHostsInNetworksConfig

func ResolveHostsInNetworksConfig(config *meshconfig.MeshNetworks)

ResolveHostsInNetworksConfig will go through the Gateways addresses for all networks in the config and if it's not an IP address it will try to lookup that hostname and replace it with the IP address in the config

func SortVirtualHosts

func SortVirtualHosts(hosts []route.VirtualHost)

SortVirtualHosts sorts a slice of virtual hosts by name.

Envoy computes a hash of RDS to see if things have changed - hash is affected by order of elements in the filter. Therefore we sort virtual hosts by name before handing them back so the ordering is stable across HTTP Route Configs.

func SplitLocality

func SplitLocality(locality string) (region, zone, subzone string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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