func NewConfig() (*Config, error) {
	data, err := bootstrapConfigFromEnvVariable()
	if err != nil {
		return nil, fmt.Errorf("xds: Failed to read bootstrap config: %v", err)
	}
	logger.Debugf("Bootstrap content: %s", data)
	return NewConfigFromContents(data)
}
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_servers": [
{
"server_uri": <string containing URI of management server>,
"channel_creds": [
{
"type": <string containing channel cred type>,
"config": <JSON object containing config for the type>
}
],
"server_features": [ ... ],
}
],
"node": <JSON form of Node proto>,
"certificate_providers" : {
"default": {
"plugin_name": "default-plugin-name",
"config": { default plugin config in JSON }
},
"foo": {
"plugin_name": "foo",
"config": { foo plugin config in JSON }
}
},
"server_listener_resource_name_template": "grpc/server?xds.resource.listening_address=%s"
}

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 bootstrap
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io/ioutil"
	v2corepb "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"
	v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
	"github.com/golang/protobuf/jsonpb"
	"github.com/golang/protobuf/proto"
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/google"
	"google.golang.org/grpc/credentials/insecure"
	"google.golang.org/grpc/credentials/tls/certprovider"
	"google.golang.org/grpc/internal"
	"google.golang.org/grpc/internal/pretty"
	"google.golang.org/grpc/internal/xds/env"
	"google.golang.org/grpc/xds/internal/version"
)
const (
	serverFeaturesV3 = "xds_v3"
	credsGoogleDefault              = "google_default"
	credsInsecure                   = "insecure"
	gRPCUserAgentName               = "gRPC Go"
	clientFeatureNoOverprovisioning = "envoy.lb.does_not_support_overprovisioning"
)
var gRPCVersion = fmt.Sprintf("%s %s", gRPCUserAgentName, grpc.Version)
var bootstrapFileReadFunc = ioutil.ReadFile
type Config struct {
	BalancerName string
	Creds grpc.DialOption
	TransportAPI version.TransportAPI
	NodeProto proto.Message
	CertProviderConfigs map[string]*certprovider.BuildableConfig
	ServerListenerResourceNameTemplate string
}
type channelCreds struct {
	Type   string          `json:"type"`
	Config json.RawMessage `json:"config"`
}
type xdsServer struct {
	ServerURI      string         `json:"server_uri"`
	ChannelCreds   []channelCreds `json:"channel_creds"`
	ServerFeatures []string       `json:"server_features"`
}
func bootstrapConfigFromEnvVariable() ([]byte, error) {
	fName := env.BootstrapFileName
	fContent := env.BootstrapFileContent
	if fName != "" {
		logger.Debugf("xds: using bootstrap file with name %q", fName)
		return bootstrapFileReadFunc(fName)
	}
	if fContent != "" {
		return []byte(fContent), nil
	}
	return nil, fmt.Errorf("none of the bootstrap environment variables (%q or %q) defined", env.BootstrapFileNameEnv, env.BootstrapFileContentEnv)
}