5.105. kink/tls/TLS

5.105.1. type tls

An either end of a TLS connection.

5.105.1.1. Tls.tcp

`tcp` returns a `tcp` val as the TCP connecting socket backing the TLS connection.

5.105.1.2. Tls.input(...[$config={}])

`input` returns an `input` of the TLS connection.

When `close` is called for the returned input, the TLS connection is closed. It's because there is no such feature to close only the input of a TLS connection.

Preconditions

• $config must be a fun which takes a config val

• The TLS connection must be open.

Config val methods

• C.buffer(...[Preferred_buf_size]): Do buffering for the input. Preferred_buf_size must be an non-negative int num, which is used as the preferred buffer size. If `buffer` is not called, the input does not perform buffering.

5.105.1.3. Tls.output(...[$config={}])

`output` returns an `output` of the TLS connection.

When `close` is called for the returned output, the TLS connection is closed. It's because there is no such feature to close only the output of a TLS connection.

Preconditions

• $config must be a fun which takes a config val

• The TLS connection must be open.

Config val methods

• C.buffer(...[Preferred_buf_size]): Do buffering for the output. Preferred_buf_size must be an non-negative int num, which is used as the preferred buffer size. If `buffer` is not called, the output does not perform buffering.

5.105.1.4. Tls.close(...[$config={}])

`close` closes the TLS connection.

Config methods:

• C.on_success($success): default = {}

• C.on_error($error): default = {(:Exc) Exc.raise }

If the TLS connection is successfully closed, `close` tail-calls $success with no argument.

If an IO error occurs, `close` tail-calls $error with an `exception`.

When the TLS connection is already closed, calling this method does nothing.

Note that the backing TCP connection is NOT closed by this method.

Preconditions

• $success must be a fun which takes no arg

• $error must be a fun which takes an `exception`

5.105.2. TLS.is?(Val)

`is?` returns whether `Val` is a val of `tls` type.