grpc: google.golang.org/grpc/xds/internal/client Index | Files

package client

import "google.golang.org/grpc/xds/internal/client"

Package client contains the implementation of the xds client used by grpc-lb-v2.

Index

Package Files

config.go

type Config Uses

type Config struct {
    // BalancerName is the name of the xDS server to connect to.
    BalancerName string
    // Creds contains the credentials to be used while talking to the xDS
    // server, as a grpc.DialOption.
    Creds grpc.DialOption
    // NodeProto contains the basepb.Node proto to be used in xDS calls made to the
    // server.
    NodeProto *basepb.Node
}

Config provides the xDS client with several key bits of information that it requires in its interaction with an xDS server. The Config is initialized from the bootstrap file. If that process fails for any reason, it uses the defaults passed in.

func NewConfig Uses

func NewConfig() *Config

NewConfig returns a new instance of Config initialized by reading the bootstrap file found at ${GRPC_XDS_BOOTSTRAP}.

The format of the bootstrap file will be as follows: {

"xds_server": {
  "server_uri": <string containing URI of xds server>,
  "channel_creds": [
    {
      "type": <string containing channel cred type>,
      "config": <JSON object containing config for the type>
    }
  ]
},
"node": <JSON form of basepb.Node proto>

}

Currently, we support exactly one type of credential, which is "google_default", where we use the host's default certs for transport credentials and a Google oauth token for call credentials.

This function tries to process as much of the bootstrap file as possible (in the presence of the errors) and may return a Config object with certain fields left unspecified, in which case the caller should use some sane defaults.

Package client imports 9 packages (graph) and is imported by 1 packages. Updated 2019-10-06. Refresh now. Tools for package owners.