istio: istio.io/istio/pilot/pkg/networking/util Index | Files

package util

import "istio.io/istio/pilot/pkg/networking/util"

Index

Package Files

util.go

Constants

const (
    // BlackHoleCluster to catch traffic from routes with unresolved clusters. Traffic arriving here goes nowhere.
    BlackHoleCluster = "BlackHoleCluster"
    // BlackHoleRouteName is the name of the route that blocks all traffic.
    BlackHoleRouteName = "block_all"
    // PassthroughCluster to forward traffic to the original destination requested. This cluster is used when
    // traffic does not match any listener in envoy.
    PassthroughCluster = "PassthroughCluster"
    // PassthroughRouteName is the name of the route that forwards traffic to the
    // PassthroughCluster
    PassthroughRouteName = "allow_any"

    // Inbound pass through cluster need to the bind the loopback ip address for the security and loop avoidance.
    InboundPassthroughClusterIpv4 = "InboundPassthroughClusterIpv4"
    InboundPassthroughClusterIpv6 = "InboundPassthroughClusterIpv6"
    // 6 is the magical number for inbound: 15006, 127.0.0.6, ::6
    InboundPassthroughBindIpv4 = "127.0.0.6"
    InboundPassthroughBindIpv6 = "::6"

    // SniClusterFilter is the name of the sni_cluster envoy filter
    SniClusterFilter = "envoy.filters.network.sni_cluster"
    // IstioMetadataKey is the key under which metadata is added to a route or cluster
    // regarding the virtual service or destination rule used for each
    IstioMetadataKey = "istio"

    // EnvoyTransportSocketMetadataKey is the key under which metadata is added to an endpoint
    // which determines the endpoint level transport socket configuration.
    EnvoyTransportSocketMetadataKey = "envoy.transport_socket_match"

    // EnvoyRawBufferSocketName matched with hardcoded built-in Envoy transport name which determines
    // endpoint level plantext transport socket configuration
    EnvoyRawBufferSocketName = "raw_buffer"

    // EnvoyTLSSocketName matched with hardcoded built-in Envoy transport name which determines endpoint
    // level tls transport socket configuration
    EnvoyTLSSocketName = "tls"
)

Variables

var ALPNH2Only = []string{"h2"}

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

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

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

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.

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"}.

var EndpointMetadataMtlsReady = &pstruct.Struct{
    Fields: map[string]*pstruct.Value{
        model.MTLSReadyLabelShortname: {Kind: &pstruct.Value_StringValue{StringValue: "true"}},
    },
}

func BuildAddress Uses

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

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

func BuildConfigInfoMetadata Uses

func BuildConfigInfoMetadata(config model.ConfigMeta) *core.Metadata

BuildConfigInfoMetadata builds core.Metadata struct containing the name.namespace of the config, the type, etc. Used by Mixer client to generate attributes for policy and telemetry.

func BuildLbEndpointMetadata Uses

func BuildLbEndpointMetadata(uid string, network string, mtlsReady bool) *core.Metadata

BuildLbEndpointMetadata adds metadata values to a lb endpoint

func CloneCluster Uses

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

return a shallow copy cluster

func CloneClusterLoadAssignment Uses

func CloneClusterLoadAssignment(original *xdsapi.ClusterLoadAssignment) xdsapi.ClusterLoadAssignment

return a shallow copy ClusterLoadAssignment

func ConvertAddressToCidr Uses

func ConvertAddressToCidr(addr string) *core.CidrRange

ConvertAddressToCidr converts from string to CIDR proto

func ConvertLocality Uses

func ConvertLocality(locality string) *core.Locality

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

func GetByAddress Uses

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

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

func GetNetworkEndpointAddress Uses

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

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

func GogoDurationToDuration Uses

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

GogoDurationToDuration converts from gogo proto duration to time.duration

func HandleCrash Uses

func HandleCrash(handlers ...func())

HandleCrash catches the crash and calls additional handlers.

func IsHTTPFilterChain Uses

func IsHTTPFilterChain(filterChain *listener.FilterChain) bool

IsHTTPFilterChain returns true if the filter chain contains a HTTP connection manager filter

func IsIstioVersionGE12 Uses

func IsIstioVersionGE12(node *model.Proxy) bool

IsIstioVersionGE12 checks whether the given Istio version is greater than or equals 1.2.

func IsIstioVersionGE13 Uses

func IsIstioVersionGE13(node *model.Proxy) bool

IsIstioVersionGE13 checks whether the given Istio version is greater than or equals 1.3.

func IsIstioVersionGE14 Uses

func IsIstioVersionGE14(node *model.Proxy) bool

IsIstioVersionGE14 checks whether the given Istio version is greater than or equals 1.4.

func IsLocalityEmpty Uses

func IsLocalityEmpty(locality *core.Locality) bool

IsLocalityEmpty checks if a locality is empty (checking region is good enough, based on how its initialized)

func IsProtocolSniffingEnabledForInbound Uses

func IsProtocolSniffingEnabledForInbound(node *model.Proxy) bool

func IsProtocolSniffingEnabledForInboundPort Uses

func IsProtocolSniffingEnabledForInboundPort(node *model.Proxy, port *model.Port) bool

func IsProtocolSniffingEnabledForOutbound Uses

func IsProtocolSniffingEnabledForOutbound(node *model.Proxy) bool

IsProtocolSniffingEnabled checks whether protocol sniffing is enabled.

func IsProtocolSniffingEnabledForOutboundPort Uses

func IsProtocolSniffingEnabledForOutboundPort(node *model.Proxy, port *model.Port) bool

func IsProtocolSniffingEnabledForPort Uses

func IsProtocolSniffingEnabledForPort(node *model.Proxy, port *model.Port) bool

func IsXDSMarshalingToAnyEnabled Uses

func IsXDSMarshalingToAnyEnabled(node *model.Proxy) bool

IsXDSMarshalingToAnyEnabled controls whether "marshaling to Any" feature is enabled.

func LbPriority Uses

func LbPriority(proxyLocality, endpointsLocality *core.Locality) int

func LocalityLbWeightNormalize Uses

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

LocalityLbWeightNormalize set LocalityLbEndpoints within a cluster with a valid LoadBalancingWeight.

func LocalityMatch Uses

func LocalityMatch(proxyLocality *core.Locality, ruleLocality string) bool

func LocalityToString Uses

func LocalityToString(l *core.Locality) string

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

func MergeAnyWithAny Uses

func MergeAnyWithAny(dst *any.Any, src *any.Any) (*any.Any, error)

MergeAnyWithAny merges a given any typed message into the given Any typed message by dynamically inferring the type of Any

func MergeAnyWithStruct Uses

func MergeAnyWithStruct(a *any.Any, pbStruct *pstruct.Struct) (*any.Any, error)

MergeAnyWithStruct merges a given struct into the given Any typed message by dynamically inferring the type of Any, converting the struct into the inferred type, merging the two messages, and then marshaling the merged message back into Any.

func MessageToAny Uses

func MessageToAny(msg proto.Message) *any.Any

MessageToAny converts from proto message to proto Any

func MessageToAnyWithError Uses

func MessageToAnyWithError(msg proto.Message) (*any.Any, error)

MessageToAnyWithError converts from proto message to proto Any

func MessageToStruct Uses

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

MessageToStruct converts from proto message to proto Struct

func ResolveHostsInNetworksConfig Uses

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 Uses

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 Uses

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

Package util imports 25 packages (graph) and is imported by 33 packages. Updated 2019-10-22. Refresh now. Tools for package owners.