FakeRiak.TLS (fake_riak v0.2.0)

Copy Markdown View Source

Detects whether a freshly accepted connection is starting a TLS handshake and, if so, silently terminates TLS before handing the plaintext byte stream to FakeRiak.Connection. Everything else is served as plain TCP, so every listener transparently accepts both on the same port.

Summary

Functions

Peeks at the first byte of socket to pick plain TCP vs TLS, then serves the connection.

Runs the server-side TLS handshake on a plain socket, using the identity resolved at boot (:tls_options). Also used by FakeRiak.Connection for in-band upgrades like Riak's RpbStartTls.

Resolves the TLS server identity once at boot: a user-supplied cert/key file pair (:tls_cert_files config, set by the CLI), or an ephemeral self-signed certificate generated on the fly.

Functions

accept(socket, handler)

Peeks at the first byte of socket to pick plain TCP vs TLS, then serves the connection.

handshake(socket)

Runs the server-side TLS handshake on a plain socket, using the identity resolved at boot (:tls_options). Also used by FakeRiak.Connection for in-band upgrades like Riak's RpbStartTls.

server_options()

Resolves the TLS server identity once at boot: a user-supplied cert/key file pair (:tls_cert_files config, set by the CLI), or an ephemeral self-signed certificate generated on the fly.