Documentation ¶
Index ¶
Constants ¶
const ( TranslatorEnvPkiAddress = "PKI_ADDRESS" TranslatorEnvIngressPort = "INGRESS_PORT" TranslatorEnvEgressPort = "EGRESS_PORT" TranslatorEnvCommonName = "COMMON_NAME" TranslatorDefaultIngressPort = 50051 TranslatorDefaultEgressPort = 50052 TranslatorDefaultCaPath = "/ca" TranslatorDefaultCsrPath = "/csr" )
const ( ErrPkiAddressNotSet = "pki address not set" ErrCommonNameNotSet = "common name not set" )
Variables ¶
This section is empty.
Functions ¶
func SetLogLevel ¶ added in v1.1.0
Types ¶
type Translator ¶
type Translator struct {
// contains filtered or unexported fields
}
Translator acts as the server for translation and communicating with envoy.
func NewTranslator ¶
func NewTranslator(config *TranslatorConfig) (*Translator, error)
NewTranslator creates a new translator that adheres to the given config.
func (*Translator) Start ¶
func (translator *Translator) Start()
Start runs the server by ensuring the PKI key material and then starting the grpc servers. When a system interrupt is received the server stops.
func (*Translator) Stop ¶
func (translator *Translator) Stop()
Stop closes the server and returns the "start" function.
type TranslatorConfig ¶
type TranslatorConfig struct { // Port for the incoming communication grpc server. IngressPort int // Function for the incoming translation. IngressTranslator translator.IngressTranslation // Port for the outgoing communication grpc server. EgressPort int // Function for the outgoing translation. EgressTranslator translator.EgressTranslation // Config for the PKI. pki.Config // Config for the WirePact JWT. wirepact.JWTConfig }
TranslatorConfig contains all necessary configurations for the Translator.
func NewConfigFromEnvironmentVariables ¶
func NewConfigFromEnvironmentVariables( ingressTranslator translator.IngressTranslation, egressTranslator translator.EgressTranslation) (TranslatorConfig, error)
NewConfigFromEnvironmentVariables returns a TranslatorConfig that is filled with values from environment variables. The config can further be customized after it is returned.
The variables are: INGRESS_PORT, EGRESS_PORT, PKI_ADDRESS, COMMON_NAME The common name gets set for the certificate common name and the issuer for the JWTs. Ingress and Egress ports have default values.