func loadKeyPair(cert, key []byte) (tls.Certificate, *x509.Certificate, error) {
	c, err := tls.X509KeyPair(cert, key)
	if err != nil {
		return tls.Certificate{}, &x509.Certificate{}, err
	}
	pemData, _ := pem.Decode(cert)
	ca, err := x509.ParseCertificate(pemData.Bytes)
	if err != nil {
		return tls.Certificate{}, &x509.Certificate{}, err
	}
	return c, ca, nil
}
loadKeyPair - internal function for load certificate and private key pair.
package herots
import (
	"crypto/rand"
	"crypto/tls"
	"crypto/x509"
	"encoding/pem"
	"fmt"
	"io"
	"net"
	"os"
	"strconv"
)
type LogHandlerFunc func(message string, lvl LogLevelType)
type LogLevelType int
const (
	LogLevelNone LogLevelType = iota
	LogLevelNotice
	LogLevelInfo
	LogLevelError
)
type log struct {
	LogLevel       LogLevelType
	LogDestination io.Writer
	Handler        LogHandlerFunc
}
func (l *log) Log(message string, lvl LogLevelType) {
	if l.Handler != nil {
		l.Handler(message, lvl)
		return
	}
	if l.LogLevel == 0 {
		return
	}
	if lvl <= l.LogLevel {
		fmt.Fprintf(l.LogDestination, "herots: %s\n", message)
	}
}