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.
When the TLS connection is already closed, calling this method does nothing.
Note that the backing TCP connection is NOT closed by this method.
Precondition
• $config must be a fun which takes a config val.
Config val methods
• C.on_success($success): uses $success as the success cont. If `on_success` is not called, `{}` is used as the default success cont.
• C.on_error($error): uses $error as the error cont. If `on_error` is not called, an exception is raised on an IO error.
Result
If the TLS connection is successfully closed, `close` tail-calls the success cont with no argument.
If an IO error occurs, `close` tail-calls the error cont.
5.105.2. TLS.is?(Val)¶
`is?` returns whether `Val` is a val of `tls` type.