istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pilot/pkg/networking/util/internal_upstream.go (about)

     1  // Copyright Istio Authors
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package util
    16  
    17  import (
    18  	core "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
    19  	internalupstream "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/internal_upstream/v3"
    20  	rawbuffer "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/raw_buffer/v3"
    21  	metadata "github.com/envoyproxy/go-control-plane/envoy/type/metadata/v3"
    22  
    23  	"istio.io/istio/pilot/pkg/util/protoconv"
    24  )
    25  
    26  var TunnelHostMetadata = []*internalupstream.InternalUpstreamTransport_MetadataValueSource{
    27  	{
    28  		Kind: &metadata.MetadataKind{Kind: &metadata.MetadataKind_Host_{Host: &metadata.MetadataKind_Host{}}},
    29  		Name: OriginalDstMetadataKey,
    30  	},
    31  }
    32  
    33  var DefaultInternalUpstreamTransportSocket = &core.TransportSocket{
    34  	Name: "internal_upstream",
    35  	ConfigType: &core.TransportSocket_TypedConfig{TypedConfig: protoconv.MessageToAny(&internalupstream.InternalUpstreamTransport{
    36  		TransportSocket: &core.TransportSocket{
    37  			Name:       "raw_buffer",
    38  			ConfigType: &core.TransportSocket_TypedConfig{TypedConfig: protoconv.MessageToAny(&rawbuffer.RawBuffer{})},
    39  		},
    40  	})},
    41  }
    42  
    43  var TunnelHostInternalUpstreamTransportSocket = &core.TransportSocket{
    44  	Name: "internal_upstream",
    45  	ConfigType: &core.TransportSocket_TypedConfig{TypedConfig: protoconv.MessageToAny(&internalupstream.InternalUpstreamTransport{
    46  		PassthroughMetadata: TunnelHostMetadata,
    47  		TransportSocket: &core.TransportSocket{
    48  			Name:       "raw_buffer",
    49  			ConfigType: &core.TransportSocket_TypedConfig{TypedConfig: protoconv.MessageToAny(&rawbuffer.RawBuffer{})},
    50  		},
    51  	})},
    52  }