Documentation ¶
Index ¶
- Variables
- func CreateUpstreamTLSContext(upstreamCACert, privateKey, publicKey string) *tlsv3.UpstreamTlsContext
- func InitConsul()
- func IsDiscoveryServiceEndpoint(str string) bool
- func ParseConsulSyntax(str string) (string, string, error)
- func SetClusterConsulResultMap(key string, value []Upstream)
- type ConsulClient
- type DefaultHost
- type Proxy
- type Query
- type Root
- type RootCertResp
- type ServiceCertResp
- type Upstream
Constants ¶
This section is empty.
Variables ¶
var ( //IsServiceDiscoveryEnabled whether Consul service discovery should be enabled IsServiceDiscoveryEnabled bool //MeshEnabled whether Consul service mesh is enabled or not MeshEnabled bool //MeshCACert a CA cert of Consul Mesh MeshCACert string //MeshServiceCert public cert of Router MeshServiceCert string //MeshServiceKey private key of Router MeshServiceKey string //MeshUpdateSignal send a signal to notify that a cert update should be propagated to envoy MeshUpdateSignal chan bool //ConsulClientInstance instance for consul client ConsulClientInstance ConsulClient //ClusterConsulKeyMap Cluster Name -> consul syntax key ClusterConsulKeyMap map[string]string //ClusterConsulResultMap Cluster Name -> Upstream //saves the last result with respected to a cluster ClusterConsulResultMap map[string][]Upstream //ClusterConsulDoneChanMap Cluster Name -> doneChan for respective go routine //when the cluster is removed we can stop the respective go routine to stop polling and release resources ClusterConsulDoneChanMap map[string]chan bool //ServiceConsulMeshMap Service -> whether in Mesh ServiceConsulMeshMap map[string]bool )
Functions ¶
func CreateUpstreamTLSContext ¶
func CreateUpstreamTLSContext(upstreamCACert, privateKey, publicKey string) *tlsv3.UpstreamTlsContext
CreateUpstreamTLSContext create a new TLS context using CA, private key and public key
func InitConsul ¶
func InitConsul()
InitConsul loads certs and initialize a ConsulClient lazy loading
func IsDiscoveryServiceEndpoint ¶
IsDiscoveryServiceEndpoint checks whether an endpoint string is a consul syntax string
func ParseConsulSyntax ¶
ParseConsulSyntax breaks the syntax string into query string and default host string
func SetClusterConsulResultMap ¶
SetClusterConsulResultMap avoid concurrent map writes when writing to ClusterConsulResultMap
Types ¶
type ConsulClient ¶
type ConsulClient struct {
// contains filtered or unexported fields
}
ConsulClient wraps the HTTP API
func NewConsulClient ¶
func NewConsulClient(api http.Client, longPollClient http.Client, scheme string, host string, aclToken string) ConsulClient
NewConsulClient constructor for ConsulClient
func (ConsulClient) LongPollRootCert ¶
func (c ConsulClient) LongPollRootCert(signal chan bool)
LongPollRootCert starts long polling root certificate
func (ConsulClient) LongPollServiceCertAndKey ¶
func (c ConsulClient) LongPollServiceCertAndKey(signal chan bool)
LongPollServiceCertAndKey starts long polling for service cert and key
type DefaultHost ¶
DefaultHost host and port of the default host Clusters are initialized with default host at the time of initialization of an api project
type Query ¶
Query query structure for a consul string syntax
func ParseQueryString ¶
ParseQueryString parses the string into a Query struct
type RootCertResp ¶
type RootCertResp struct {
Roots []Root
}
RootCertResp structure of a response to a request to get the root certificates
type ServiceCertResp ¶
ServiceCertResp structure of a response to get a service's certificate and private key
type Upstream ¶
Upstream Data for a service instance
func GetClusterConsulResultMap ¶
GetClusterConsulResultMap avoid concurrent map reads/writes when reading from ClusterConsulResultMap