google.golang.org/grpc@v1.72.2/xds/internal/clients/config.go (about)

     1  /*
     2   *
     3   * Copyright 2024 gRPC authors.
     4   *
     5   * Licensed under the Apache License, Version 2.0 (the "License");
     6   * you may not use this file except in compliance with the License.
     7   * You may obtain a copy of the License at
     8   *
     9   *     http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the License for the specific language governing permissions and
    15   * limitations under the License.
    16   *
    17   */
    18  
    19  // Package clients provides implementations of the clients to interact with
    20  // xDS and LRS servers.
    21  //
    22  // # xDS Client
    23  //
    24  // The xDS client allows applications to:
    25  //   - Create client instances with in-memory configurations.
    26  //   - Register watches for named resources.
    27  //   - Receive resources via the ADS (Aggregated Discovery Service) stream.
    28  //
    29  // This enables applications to dynamically discover and configure resources
    30  // such as listeners, routes, clusters, and endpoints from an xDS management
    31  // server.
    32  //
    33  // # LRS Client
    34  //
    35  // The LRS (Load Reporting Service) client allows applications to report load
    36  // data to an LRS server via the LRS stream. This data can be used for
    37  // monitoring, traffic management, and other purposes.
    38  //
    39  // # Experimental
    40  //
    41  // NOTICE: This package is EXPERIMENTAL and may be changed or removed
    42  // in a later release.
    43  package clients
    44  
    45  // ServerIdentifier holds identifying information for connecting to an xDS
    46  // management or LRS server.
    47  type ServerIdentifier struct {
    48  	// ServerURI is the target URI of the server.
    49  	ServerURI string
    50  
    51  	// Extensions can be populated with arbitrary data to be passed to the
    52  	// TransportBuilder and/or xDS Client's ResourceType implementations.
    53  	// This field can be used to provide additional configuration or context
    54  	// specific to the user's needs.
    55  	//
    56  	// The xDS and LRS clients do not interpret the contents of this field.
    57  	// It is the responsibility of the user's custom TransportBuilder and/or
    58  	// ResourceType implementations to handle and interpret these extensions.
    59  	//
    60  	// For example, a custom TransportBuilder might use this field to
    61  	// configure a specific security credentials.
    62  	Extensions any
    63  }
    64  
    65  // Node represents the identity of the xDS client, allowing xDS and LRS servers
    66  // to identify the source of xDS requests.
    67  type Node struct {
    68  	// ID is a string identifier of the application.
    69  	ID string
    70  	// Cluster is the name of the cluster the application belongs to.
    71  	Cluster string
    72  	// Locality is the location of the application including region, zone,
    73  	// sub-zone.
    74  	Locality Locality
    75  	// Metadata provides additional context about the application by associating
    76  	// arbitrary key-value pairs with it.
    77  	Metadata any
    78  	// UserAgentName is the user agent name of application.
    79  	UserAgentName string
    80  	// UserAgentVersion is the user agent version of application.
    81  	UserAgentVersion string
    82  }
    83  
    84  // Locality represents the location of the xDS client application.
    85  type Locality struct {
    86  	// Region is the region of the xDS client application.
    87  	Region string
    88  	// Zone is the area within a region.
    89  	Zone string
    90  	// SubZone is the further subdivision within a zone.
    91  	SubZone string
    92  }