Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTestCertificate ¶
func CreateTestCertificate() tls.Certificate
func StartMockServer ¶
StartMockServer creates a mock TCP server and returns a network listener. The server listens on the specified TCP port on the loopback address, "127.0.0.1". The returned listener should be closed after use to free the associated resources.
func StartMockTLSServer ¶
StartMockTLSServer creates a mock TLS TCP server and returns a network listener. It loads the X.509 key pair from the given PEM-encoded files, 'testcert.pem' and 'testkey.pem', for TLS configuration. If the key pair cannot be loaded, the function aborts with a fatal error. The server listens on the specified TCP port on the loopback address, "127.0.0.1". The returned listener should be closed after use to free the associated resources. To create these test certificate files, you can use OpenSSL with the following commands in your `test_data` folder under project root:
`openssl req -newkey rsa:2048 -nodes -keyout testkey.pem -x509 -days 365 -out testcert.pem`
Types ¶
This section is empty.