Documentation
¶
Overview ¶
Package herots provide fast way to create TLS services: server and client.
Explanation of the name: HERald Of The Swarm
By the way - have a nice day :)
Index ¶
Constants ¶
const ( LoadKeyPairError = "load key pair error" NoKeyPairLoadError = "no load key pair (use LoadKeyPair func)" )
predefined errors messages
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client - primary struct for client implementation.
func (*Client) AddCertToRootCA ¶
AddCertToRootCA - function to load additional certificates to root CA pool.
func (*Client) LoadKeyPair ¶
LoadKeyPair - function for load certificate and private key pair.
Public/private key pair require as PEM encoded data.
type LogHandlerFunc ¶
type LogHandlerFunc func(message string, lvl LogLevelType)
LogHandlerFunc - type for log handler functions
type LogLevelType ¶
type LogLevelType int
LogLevelType - declare the level of informatyvity of log message
const ( LogLevelNone LogLevelType = iota LogLevelNotice LogLevelInfo LogLevelError )
predefined LogLevelType levels
type Options ¶
type Options struct {
// Server host.
//
// Default: '127.0.0.1'.
Host string
// Server port.
//
// Default: '9000'.
Port int
// LogLevel provides the opportunity to choose the level of
// information messages.
// Each level includes the messages from the previous level.
// LogLevelNone - no messages // 0
// LogLevelNotice - notice // 1
// LogLevelInfo - info // 2
// LogLevelError - error // 3
//
// Default: LogLevelNone.
LogLevel LogLevelType
// LogDestination provides the opportunity to choose the own
// destination for log messages (errors, info, etc).
//
// Default: 'os.Stdout'.
LogDestination io.Writer
// LogHandler takes log messages to bypass the internal
// mechanism of the message processing
//
// If LogHandler is selected - all log settings will be ignored.
LogHandler LogHandlerFunc
// TLSAuthType - refer to http://golang.org/pkg/crypto/tls/#ClientAuthType
//
// This option ignored for client implementation.
//
// Default: tls.RequireAnyClientCert
TLSAuthType tls.ClientAuthType
}
Options - structure, which is used to configure a TLS server and client.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server - primary struct for server implementation.
func (*Server) AddClientCACert ¶
AddClientCACert - function for adding client CA certificate to x509.CertPool (tls.Config.ClientCAs).
By default server add cert from server public/private key pair (LoadKeyPair) to cert pool.
func (*Server) LoadKeyPair ¶
LoadKeyPair - function for load certificate and private key pair.
Public/private key pair require as PEM encoded data.