Documentation
¶
Index ¶
- func CreateCACert(cn string) (cert string, key string, err error)
- func CreateClientCert(ca *tls.Certificate, cn string, days int) (cert string, key string, err error)
- func CreateServerCert(ca *tls.Certificate, cn string, hosts []string, days int) (cert string, key string, err error)
- func DirExists(path string) bool
- func Exists(path string) bool
- func FileExists(path string) bool
- func HostIP() string
- func HostToIP(host string) net.IP
- func IsLocalHost(host string) bool
- func IsLocalIP(ip net.IP) bool
- func IsPrivateHost(host string) bool
- func IsPrivateIP(ip net.IP) bool
- func LoadCertificate(certEnc, keyEnc string) (crt *tls.Certificate, err error)
- func Logger() grpclog.LoggerV2
- func Pemify(variant string, data []byte) []byte
- func RunCmd(name string, args ...string) error
- func SetLogger(log grpclog.LoggerV2)
- func TLSCertKey(crt *tls.Certificate) (cert, key string)
- type Config
- type ConfigBroker
- type ConfigBrokerConfigs
- type ConfigCertificate
- type CynoError
- type ObjMap
- type StringMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCACert ¶
CreateCACert creates a certificate authority.
func CreateClientCert ¶
func CreateClientCert(ca *tls.Certificate, cn string, days int) (cert string, key string, err error)
CreateClientCert creates a client authentication cert from a certificate authority.
func CreateServerCert ¶
func CreateServerCert(ca *tls.Certificate, cn string, hosts []string, days int) (cert string, key string, err error)
CreateServerCert creates a server cert from a certificate authority.
func FileExists ¶
FileExists returns whether the path exists and is a plain file.
func IsLocalHost ¶
IsLocalHost returns whether the given host resolves within a local IP range.
func IsPrivateHost ¶
IsPrivateHost returns whether the given host resolves within a IANA private IP range.
func IsPrivateIP ¶
IsPrivateIP returns whether the given IP is within a IANA private IP range.
func LoadCertificate ¶
func LoadCertificate(certEnc, keyEnc string) (crt *tls.Certificate, err error)
LoadCertificate will load a TLS certificate from the provided base 64 encoded derBytes.
func TLSCertKey ¶
func TLSCertKey(crt *tls.Certificate) (cert, key string)
TLSCertKey returns the cert and key derBytes from the certificate.
Types ¶
type Config ¶
type Config struct { Server string `json:"server,omitempty"` Names []string `json:"names,omitempty"` Root string `json:"root,omitempty"` Authority *ConfigCertificate `json:"authority,omitempty"` Certificate *ConfigCertificate `json:"certificate,omitempty"` Brokers map[string]*ConfigBroker `json:"brokers,omitempty"` // contains filtered or unexported fields }
Config contains the config file details.
func LoadConfig ¶
LoadConfig reads the passed in config filename, parses it and returns the config object.
func (*Config) CertPool ¶
CertPool returns a pool of certificates that we will trust for connections.
func (*Config) ClientCert ¶
func (c *Config) ClientCert(days int) (crt *tls.Certificate, err error)
ClientCert returns a valid client certificate (or generates one if possible and none available).
func (*Config) Log ¶
Log returns the logger that things running from this config should use to output info.
func (*Config) ServerCert ¶
func (c *Config) ServerCert(days int) (crt *tls.Certificate, err error)
ServerCert returns a valid server certificate (or generates one if possible and none available).
type ConfigBroker ¶
type ConfigBroker struct { Kind string `json:"kind,omitempty"` Config ConfigBrokerConfigs `json:"config,omitempty"` }
ConfigBroker specifies the broker kind for the config file.
type ConfigBrokerConfigs ¶
type ConfigBrokerConfigs struct { Default StringMap `json:"default,omitempty"` Namespaced map[string]StringMap `json:"namespaced,omitempty"` }
ConfigBrokerConfigs contains the broker configuration for the config file.
type ConfigCertificate ¶
type ConfigCertificate struct { CA string `json:"ca,omitempty"` Cert string `json:"cert,omitempty"` Key string `json:"key,omitempty"` }
ConfigCertificate contains the certificate details for the config file.
type CynoError ¶
CynoError can wrap a generic error with our own messages.