Liking cljdoc? Tell your friends :D
All platforms.

clunk.tls

clj

Opens a client's connection on the JVM, over TLS when its config asks for it (see clunk.core/ssl-config for the settings).

TLS here is JSSE's SSLSocket layered over the connected SocketChannel's socket, with blocking streams. connect hands back a ByteChannel either way, so the connection's reader thread reads it, and whoever starts a query writes it, as they would a SocketChannel; SSLSocket lets one thread read while another writes. A non-blocking (selector) design would need SSLEngine instead; a prototype of it benchmarked the same.

Opens a client's connection on the JVM, over TLS when its config asks for
it (see clunk.core/ssl-config for the settings).

TLS here is JSSE's SSLSocket layered over the connected SocketChannel's
socket, with blocking streams. connect hands back a ByteChannel either
way, so the connection's reader thread reads it, and whoever starts a
query writes it, as they would a SocketChannel; SSLSocket lets one thread
read while another writes. A non-blocking (selector) design would need
SSLEngine instead; a prototype of it benchmarked the same.
cljs

Opens a client's connection on Node, over TLS when its config asks for it (see clunk.core/ssl-config for the settings).

connect returns at once, as net.createConnection does, and holds writes until the connection is ready, so the byte-buffer socket uses it as it uses a net.Socket. With TLS, that is a Duplex in front of the real socket: once the server has answered SSLRequest, tls.connect({socket}) upgrades the net.Socket in place, and the Duplex passes bytes to and from the TLS socket, or the plain one if :prefer falls back.

Opens a client's connection on Node, over TLS when its config asks for it
(see clunk.core/ssl-config for the settings).

connect returns at once, as net.createConnection does, and holds writes
until the connection is ready, so the byte-buffer socket uses it as it
uses a net.Socket. With TLS, that is a Duplex in front of the real
socket: once the server has answered SSLRequest, tls.connect({socket})
upgrades the net.Socket in place, and the Duplex passes bytes to and from
the TLS socket, or the plain one if :prefer falls back.
raw docstring

connectclj/s≠

clj
(connect port host {:keys [mode negotiation] :as ssl})

Connects to host:port and returns a ByteChannel to talk to Postgres on, ready for the StartupMessage. ssl is nil for a plain connection, or a map from clunk.core/ssl-config, in which case it asks for TLS (or with direct negotiation, starts it at once) and blocks until the handshake is done. Throws if TLS fails or the server won't talk TLS and the mode needs it.

Connects to host:port and returns a ByteChannel to talk to Postgres on,
ready for the StartupMessage. ssl is nil for a plain connection, or a map
from clunk.core/ssl-config, in which case it asks for TLS (or with direct
negotiation, starts it at once) and blocks until the handshake is done.
Throws if TLS fails or the server won't talk TLS and the mode needs it.
cljs
(connect port host ssl)

Connects to host:port and returns at once a socket, or socket-like Duplex, to talk to Postgres on. ssl is nil for a plain connection, or a map from clunk.core/ssl-config. Writes wait until the connection is ready for the StartupMessage. If TLS fails, or the server won't talk TLS and the mode needs it, it is destroyed with an error that says why.

Connects to host:port and returns at once a socket, or socket-like Duplex,
to talk to Postgres on. ssl is nil for a plain connection, or a map from
clunk.core/ssl-config. Writes wait until the connection is ready for the
StartupMessage. If TLS fails, or the server won't talk TLS and the mode
needs it, it is destroyed with an error that says why.
source (clj)source (cljs)raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close