istio.io/istio@v0.0.0-20240520182934-d79c90f27776/pkg/test/echo/common/model.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 common
    16  
    17  import "istio.io/istio/pkg/config/protocol"
    18  
    19  // TLSSettings defines TLS configuration for Echo server
    20  type TLSSettings struct {
    21  	// If not empty, RootCert supplies the extra root cert that will be appended to the system cert pool.
    22  	RootCert   string
    23  	ClientCert string
    24  	Key        string
    25  	// If provided, override the host name used for the connection
    26  	// This needed for integration tests, as we are connecting using a port-forward (127.0.0.1), so
    27  	// any DNS certs will not validate.
    28  	Hostname string
    29  	// If set to true, the cert will be provisioned by proxy, and extra cert volume will be mounted.
    30  	ProxyProvision bool
    31  	// AcceptAnyALPN, if true, will make the server accept ANY ALPNs. This comes at the expense of
    32  	// allowing h2 negotiation and being able to detect the negotiated ALPN (as there is none), because
    33  	// Golang doesn't like us doing this (https://github.com/golang/go/issues/46310).
    34  	// This is useful when the server is simulating Envoy which does unconventional things with ALPN.
    35  	AcceptAnyALPN bool
    36  }
    37  
    38  // Port represents a network port where a service is listening for
    39  // connections. The port should be annotated with the type of protocol
    40  // used by the port.
    41  type Port struct {
    42  	// Name ascribes a human readable name for the port object. When a
    43  	// service has multiple ports, the name field is mandatory
    44  	Name string
    45  
    46  	// Port number where the service can be reached. Does not necessarily
    47  	// map to the corresponding port numbers for the instances behind the
    48  	// service.
    49  	Port int
    50  
    51  	// Protocol to be used for the port.
    52  	Protocol protocol.Instance
    53  
    54  	// TLS determines if the port will use TLS.
    55  	TLS bool
    56  
    57  	// ServerFirst if a port will be server first
    58  	ServerFirst bool
    59  
    60  	// InstanceIP determines if echo will listen on the instance IP, or wildcard
    61  	InstanceIP bool
    62  
    63  	// LocalhostIP determines if echo will listen on the localhost IP; otherwise, it will listen on wildcard
    64  	LocalhostIP bool
    65  
    66  	// XDSServer, for gRPC servers, will use the xds.NewGRPCServer constructor to rely on XDS configuration.
    67  	// If this flag is set but the environment variable feature gates aren't, we should fail due to gRPC internals.
    68  	XDSServer bool
    69  
    70  	// XDSTestBootstrap allows settings per-endpoint bootstrap without using the GRPC_XDS_BOOTSTRAP env var
    71  	XDSTestBootstrap []byte
    72  
    73  	// XDSReadinessTLS determines if the XDS server should expect a TLS server, used for readiness probes
    74  	XDSReadinessTLS bool
    75  }
    76  
    77  // PortList is a set of ports
    78  type PortList []*Port
    79  
    80  var ServerFirstMagicString = "server-first-protocol\n"