Skip to main content

bootstrap

bootstrap

import "github.com/gojek/courier-go/xds/bootstrap"

Package bootstrap provides bootstrap config loading capabilities to xds client

Index

## type [Config](https://github.com/gojek/courier-go/blob/main/xds/bootstrap/bootstrap.go#L55-L58)

Config provides the xDS client with several key bits of information that it requires in its interaction with the management server. The Config is initialized from the bootstrap file.

type Config struct {
// XDSServer is the management server to connect to.
XDSServer *ServerConfig `json:"xds_server"`
}
### func [NewConfig](https://github.com/gojek/courier-go/blob/main/xds/bootstrap/bootstrap.go#L63)
func NewConfig() (*Config, error)

NewConfig returns a bootstrap config after reading the BootstrapConfig from the file specified by COURIER_XDS_BOOTSTRAP env var or the base64 encoded string in COURIER_XDS_BOOTSTRAP_CONFIG_BASE64 var.

### func [NewConfigFromContents](https://github.com/gojek/courier-go/blob/main/xds/bootstrap/bootstrap.go#L73)
func NewConfigFromContents(data []byte) (*Config, error)

NewConfigFromContents returns a bootstrap config after reading the BootstrapConfig from data.

## type [ServerConfig](https://github.com/gojek/courier-go/blob/main/xds/bootstrap/bootstrap.go#L95-L108)

ServerConfig contains the configuration to connect to a server, including URI, creds, and transport API version (e.g. v2 or v3).

type ServerConfig struct {
// ServerURI is the management server to connect to.
//
// The bootstrap file contains an ordered list of xDS servers to contact for
// this authority. The first one is picked.
ServerURI string `json:"server_uri"`
// NodeProto contains the Node proto to be used in xDS requests. The actual
// type depends on the transport protocol version used.
//
// Note that it's specified in the bootstrap globally for all the servers,
// but we keep it in each server config so that its type (e.g. *v3pb.Node)
// is consistent with the transport API version.
NodeProto proto.Message
}
### func \(ServerConfig\) [MarshalJSON](https://github.com/gojek/courier-go/blob/main/xds/bootstrap/bootstrap.go#L124)
func (sc ServerConfig) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ServerConfig to json.

### func \(\*ServerConfig\) [String](https://github.com/gojek/courier-go/blob/main/xds/bootstrap/bootstrap.go#L119)
func (sc *ServerConfig) String() string

String returns the string representation of the ServerConfig.

This string representation will be used as map keys in federation (`map[ServerConfig]authority`), so that the xDS ClientConn and stream will be shared by authorities with different names but the same server config.

It covers (almost) all the fields so the string can represent the config content. It doesn't cover NodeProto because NodeProto isn't used by federation.

### func \(\*ServerConfig\) [UnmarshalJSON](https://github.com/gojek/courier-go/blob/main/xds/bootstrap/bootstrap.go#L135)
func (sc *ServerConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON takes the json data (a server) and unmarshals it to the struct.

Generated by gomarkdoc