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"
    // BlackHole is the name of the virtual host and route name used to block all traffic
    BlackHole = "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"
    // Passthrough is the name of the virtual host used to forward traffic to the
    // PassthroughCluster
    Passthrough = "allow_any"
    // PassthroughFilterChain to catch traffic that doesn't match other filter chains.
    PassthroughFilterChain = "PassthroughFilterChain"

    // 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 = wellknown.TransportSocketRawBuffer

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

Variables

var ALPNDownstream = []string{"istio-peer-exchange", "h2", "http/1.1"}

ALPNDownstream advertises that Proxy is going to talking either tcp(for metadata exchange), http2 or http 1.1.

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 ALPNInMeshH2WithMxc = []string{"istio-peer-exchange", "istio", "h2"}

ALPNInMeshH2WithMxc 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. The custom "istio-peer-exchange" value indicates, metadata exchange is enabled for TCP.

var ALPNInMeshWithMxc = []string{"istio-peer-exchange", "istio"}

ALPNInMeshWithMxc advertises that Proxy is going to talk to the in-mesh cluster and has metadata exchange enabled for TCP. The custom "istio-peer-exchange" value indicates, metadata exchange is enabled for TCP. The custom "istio" value indicates in-mesh traffic and it's going to be used for routing decisions.

var FallThroughFilterChainBlackHoleService = &model.Service{
    Hostname: host.Name(BlackHoleCluster),
    Attributes: model.ServiceAttributes{
        Name: BlackHoleCluster,
    },
}

FallThroughFilterChainBlackHoleService is the blackhole service used for fall though filter chain

var FallThroughFilterChainPassthroughService = &model.Service{
    Hostname: host.Name(PassthroughCluster),
    Attributes: model.ServiceAttributes{
        Name: PassthroughCluster,
    },
}

FallThroughFilterChainPassthroughService is the passthrough service used for fall though

func AddSubsetToMetadata Uses

func AddSubsetToMetadata(md *core.Metadata, subset string) *core.Metadata

AddSubsetToMetadata will build a new core.Metadata struct containing the subset name supplied. This is used for telemetry reporting. A new core.Metadata is created to prevent modification to shared base Metadata across subsets, etc. This should be called after the initial "istio" metadata has been created for the cluster. If the "istio" metadata field is not already defined, the subset information will not be added (to prevent adding this information where not needed).

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, tlsMode string, push *model.PushContext) *core.Metadata

BuildLbEndpointMetadata adds metadata values to a lb endpoint

func BuildStatPrefix Uses

func BuildStatPrefix(statPattern string, host string, subset string, port *model.Port, attributes model.ServiceAttributes) string

BuildStatPrefix builds a stat prefix based on the stat pattern.

func CidrRangeSliceEqual Uses

func CidrRangeSliceEqual(a, b []*core.CidrRange) bool

func CloneClusterLoadAssignment Uses

func CloneClusterLoadAssignment(original *endpoint.ClusterLoadAssignment) *endpoint.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 GogoDurationToDuration Uses

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

GogoDurationToDuration converts from gogo proto duration to time.duration

func IsAllowAnyOutbound Uses

func IsAllowAnyOutbound(node *model.Proxy) bool

IsAllowAnyOutbound checks if allow_any is enabled for outbound traffic

func IsHTTPFilterChain Uses

func IsHTTPFilterChain(filterChain *listener.FilterChain) bool

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

func IsIstioVersionGE15 Uses

func IsIstioVersionGE15(node *model.Proxy) bool

IsIstioVersionGE15 checks whether the given Istio version is greater than or equals 1.5.

func IsIstioVersionGE17 Uses

func IsIstioVersionGE17(node *model.Proxy) bool

IsIstioVersionGE17 checks whether the given Istio version is greater than or equals 1.7.

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 IsProtocolSniffingEnabledForInboundPort Uses

func IsProtocolSniffingEnabledForInboundPort(port *model.Port) bool

func IsProtocolSniffingEnabledForOutboundPort Uses

func IsProtocolSniffingEnabledForOutboundPort(port *model.Port) bool

func IsProtocolSniffingEnabledForPort Uses

func IsProtocolSniffingEnabledForPort(port *model.Port) bool

func LbPriority Uses

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

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 MeshConfigToEnvoyForwardClientCertDetails Uses

func MeshConfigToEnvoyForwardClientCertDetails(c meshconfig.Topology_ForwardClientCertDetails) http_conn.HttpConnectionManager_ForwardClientCertDetails

meshconfig ForwardClientCertDetails and the Envoy config enum are off by 1 due to the UNDEFINED in the meshconfig ForwardClientCertDetails

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

func StringSliceEqual Uses

func StringSliceEqual(a, b []string) bool

func StringToExactMatch Uses

func StringToExactMatch(in []string) []*matcher.StringMatcher

func UInt32SliceEqual Uses

func UInt32SliceEqual(a, b []uint32) bool

Package util imports 28 packages (graph) and is imported by 34 packages. Updated 2020-07-14. Refresh now. Tools for package owners.