Documentation ¶
Index ¶
- func GetCertificateIssuer(cert libssl.X509) string
- func GetCertificateSubject(cert libssl.X509) string
- func GetSslError() string
- func Listen(network, laddr string, config *Config) (net.Listener, error)
- func LoadCertificate(filename string) (libssl.X509, error)
- func LoadPrivateKey(filename string) (libssl.EVP_PKEY, error)
- func NewListener(inner net.Listener, config *Config) net.Listener
- type Cipher
- type Config
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) ConnectionState() ConnectionState
- func (c *Conn) Handshake() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(buf []byte) (int, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(buf []byte) (int, error)
- type ConnectionState
- type HASH
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCertificateIssuer ¶
GetCertificateIssuer get the issuer subject from x509 certificate
func GetCertificateSubject ¶
GetCertificateSubject get the subject from x509 certificate
Types ¶
type Cipher ¶
type Cipher interface { io.ReadWriteCloser Flush() error }
func NewCipherDecrypt ¶
func NewCipherDecrypt(md libssl.EVP_CIPHER, key, iv []byte) Cipher
NewCipherDecrypt create a decrypt cipher with cipher md with key and iv, key and iv size must match the cipher md.
Write() write the ciphertext to cipher.
Read() get the plaintext.
Flush() signal no more data to cipher.
Close() free the resource.
func NewCipherEncrypt ¶
func NewCipherEncrypt(md libssl.EVP_CIPHER, key, iv []byte) Cipher
NewCipherEncrypt create a encrypt cipher with cipher md with key and iv, key and iv size must match the cipher md.
use Write() write the plaintext to cipher.
Read() get the ciphertext.
Flush() signal no more data to cipher.
Close() free the resource.
type Config ¶
type Config struct { // ServerName server sni name ServerName string // private key to use PrivateKey libssl.EVP_PKEY // ALPN names NextProtos []string // certificate to use Certificate libssl.X509 // psk identity used in psk mode Identity string // the pre-shared key used in psk mode, this field set will enable psk mode Psk []byte // skip verify server certificate InsecureSkipVerify bool // additional root ca to use RootCA libssl.X509 ClientCA libssl.X509 // verify client or not ClientAuth int }
Config tls config
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn a tls connection
func (*Conn) ConnectionState ¶
func (c *Conn) ConnectionState() ConnectionState
ConnectionState get connection state
func (*Conn) SetDeadline ¶
SetDeadline set the dead line
func (*Conn) SetReadDeadline ¶
SetReadDeadline set the read dead line
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline set the write dead line
type ConnectionState ¶
type ConnectionState struct { NegotiatedProtocol string HandshakeComplete bool PeerCertificate libssl.X509 }
ConnectionState connection state
type HASH ¶
type HASH interface { io.ReadWriteCloser Flush() error }