Versions in this module Expand all Collapse all v0 v0.0.1 Dec 4, 2018 Changes in this version + var DefaultCertLifeTime = time.Hour * 24 * 30 * 3 + var DefaultKeyLength = KeyLengthEc384 + var DefaultKeyType = KeyTypeEc + var DefaultRSAKeyLength = KeyLengthRsa3072 + var ErrKeyConfigNotCompatible = fmt.Errorf("the key type and key size are not compatible") + func GetBaseTLSConfig(host string, cert *Certificate) *tls.Config + func GetCertTemplate(names []string, ips []net.IP) *x509.Certificate + func GetID(addr string, cert *Certificate) (serverID string) + func GetSignatureAlgorithm(keyType KeyType, keyLength KeyLength) x509.SignatureAlgorithm + func NewHTTPSConnector(host string, cert *Certificate) *http.Client + func NewServiceConnector(addr, host string, cert *Certificate, timeout time.Duration) (net.Conn, error) + type BaseHandler struct + HandleFunction FuncHandler + Listener *BaseListener + MatchFunction FuncServiceMatch + NameField string + func (t *BaseHandler) Handle(conn net.Conn) (err error) + func (t *BaseHandler) Match(hostName string) bool + func (t *BaseHandler) Name() string + type BaseListener struct + AcceptChan chan net.Conn + AddrField net.Addr + func NewBaseListener(addr net.Addr) *BaseListener + func (l *BaseListener) Accept() (net.Conn, error) + func (l *BaseListener) Addr() net.Addr + func (l *BaseListener) Close() error + type Certificate struct + CACerts []*x509.Certificate + Cert *x509.Certificate + KeyPair *KeyPair + func NewCA(config *NewCertConfig, names ...string) (*Certificate, error) + func ReadToken(tokenString string) (addr *common.Addr, certificate *Certificate, err error) + func Unmarshal(input []byte) (*Certificate, error) + func (c *Certificate) GetCertPEM() []byte + func (c *Certificate) GetCertPool() (pool *x509.CertPool) + func (c *Certificate) GetTLSCertificate() tls.Certificate + func (c *Certificate) ID() *big.Int + func (c *Certificate) Marshal() ([]byte, error) + func (c *Certificate) NewCert(config *NewCertConfig, names ...string) (*Certificate, error) + type FuncGetHostNameFromAddr func(addr string) (hostName string) + type FuncHandler func(conn net.Conn) (err error) + type FuncServiceMatch func(serverName string) (match bool) + type Handler interface + Handle func(conn net.Conn) error + Match func(hostName string) bool + Name func() string + func NewHandler(name string, serviceMatchFunc FuncServiceMatch, handlerFunction FuncHandler) Handler + type KeyLength string + const KeyLengthEc256 + const KeyLengthEc384 + const KeyLengthEc521 + const KeyLengthRsa2048 + const KeyLengthRsa3072 + const KeyLengthRsa4096 + const KeyLengthRsa8192 + type KeyPair struct + Length KeyLength + Private interface{} + Public interface{} + Type KeyType + func NewEc(keyLength KeyLength) *KeyPair + func NewKeyPair(keyType KeyType, keyLength KeyLength) (*KeyPair, error) + func NewRSA(keyLength KeyLength) *KeyPair + func UnmarshalKeyPair(input []byte) (*KeyPair, error) + func (k *KeyPair) GetPrivateDER() []byte + func (k *KeyPair) GetPrivatePEM() []byte + func (k *KeyPair) Marshal() []byte + type KeyType string + const KeyTypeEc + const KeyTypeRSA + type NewCertConfig struct + CertTemplate *x509.Certificate + IsCA bool + IsWaldcard bool + LifeTime time.Duration + Parent *Certificate + PublicKey *KeyPair + func NewDefaultCertificationConfig(parent *Certificate) *NewCertConfig + func NewDefaultCertificationConfigWithDefaultTemplate(parent *Certificate, names ...string) *NewCertConfig + func (ncc *NewCertConfig) Valid() (err error) + type Server struct + AddrStruct *common.Addr + Certificate *Certificate + Echo *echo.Echo + Handlers []Handler + TLSConfig *tls.Config + TLSListener net.Listener + func NewServer(port uint16, tlsConfig *tls.Config, cert *Certificate, ...) (*Server, error) + func (s *Server) Accept() (net.Conn, error) + func (s *Server) Addr() net.Addr + func (s *Server) Close() error + func (s *Server) DeregisterService(name string) + func (s *Server) Dial(addr, hostNamePrefix string, timeout time.Duration) (net.Conn, error) + func (s *Server) GetErrorChan() chan error + func (s *Server) GetToken() (string, error) + func (s *Server) RegisterService(handler Handler) + type TransportConn struct + Server bool