Documentation ¶
Index ¶
- func GenerateCertificateTemplate(expiry time.Time) *x509.Certificate
- func GenerateSelfSignedCertificateWithPrivateKey(cert *x509.Certificate, privateKey *rsa.PrivateKey) (*x509.Certificate, []byte)
- func GenerateSignedCertificate(cert, parentCert *x509.Certificate, parentKey *rsa.PrivateKey) (*x509.Certificate, []byte, []byte)
- func GenerateTestCertificate(expiry time.Time) ([]byte, []byte)
- func SetupHTTPProxyServer() (*httptest.Server, error)
- func SetupHTTPSServer() (*httptest.Server, []byte, []byte, string, func(), error)
- func SetupHTTPSServerWithCertAndKey(caPEM, certPEM, keyPEM []byte) (*httptest.Server, string, func(), error)
- func WriteFile(filename string, contents []byte) (string, error)
- type TCPServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateCertificateTemplate ¶
func GenerateCertificateTemplate(expiry time.Time) *x509.Certificate
GenerateCertificateTemplate generates the template used to issue test certificates
func GenerateSelfSignedCertificateWithPrivateKey ¶
func GenerateSelfSignedCertificateWithPrivateKey(cert *x509.Certificate, privateKey *rsa.PrivateKey) (*x509.Certificate, []byte)
GenerateSelfSignedCertificateWithPrivateKey generates a self signed certificate with the given private key
func GenerateSignedCertificate ¶
func GenerateSignedCertificate(cert, parentCert *x509.Certificate, parentKey *rsa.PrivateKey) (*x509.Certificate, []byte, []byte)
GenerateSignedCertificate generates a certificate that is signed
func GenerateTestCertificate ¶
GenerateTestCertificate generates a test certificate with the given expiry date
func SetupHTTPProxyServer ¶
SetupHTTPProxyServer sets up a proxy server
func SetupHTTPSServer ¶
SetupHTTPSServer sets up a server for testing with a generated cert and key pair
Types ¶
type TCPServer ¶
type TCPServer struct { Listener net.Listener TLS *tls.Config // contains filtered or unexported fields }
TCPServer allows manipulation of the tls.Config before starting the listener
func SetupTCPServer ¶
SetupTCPServer sets up a server for testing with a generated cert and key pair
func SetupTCPServerWithCertAndKey ¶
func SetupTCPServerWithCertAndKey(caPEM, certPEM, keyPEM []byte) (*TCPServer, string, func(), error)
SetupTCPServerWithCertAndKey sets up a server with the provided certs and key
func (*TCPServer) Close ¶
func (t *TCPServer) Close()
Close stops the server and closes the listener
func (*TCPServer) StartFTP ¶
func (t *TCPServer) StartFTP()
StartFTP starts a listener that negotiates a TLS connection with an ftp client using AUTH TLS
func (*TCPServer) StartIMAP ¶
func (t *TCPServer) StartIMAP()
StartIMAP starts a listener that negotiates a TLS connection with an imap client using STARTTLS
func (*TCPServer) StartPOP3 ¶
func (t *TCPServer) StartPOP3()
StartPOP3 starts a listener that negotiates a TLS connection with an pop3 client using STARTTLS
func (*TCPServer) StartPostgreSQL ¶
func (t *TCPServer) StartPostgreSQL()
StartPostgreSQL starts a listener that negotiates a TLS connection with an postgresql client using STARTTLS
func (*TCPServer) StartSMTP ¶
func (t *TCPServer) StartSMTP()
StartSMTP starts a listener that negotiates a TLS connection with an smtp client using STARTTLS
func (*TCPServer) StartTLS ¶
func (t *TCPServer) StartTLS()
StartTLS starts a listener that performs an immediate TLS handshake
func (*TCPServer) StartTLSWait ¶
StartTLSWait starts a listener and waits for duration 'd' before performing the TLS handshake