# Class Netchannels_crypto.tls_layer

    class tls_layer : ?start_pos_in:int -> ?start_pos_out:int -> ?resume:string -> role:[ `Client | `Server ] -> rd:Netchannels.raw_in_channel -> wr:Netchannels.raw_out_channel -> peer_name:string option -> Netsys_crypto_types.tls_config -> tls_channel

Adds TLS security to an already established connection, here made available as separate channels for input and output.

The TLS handshake is done on the first I/O activity (call `flush` to enforce it).

`resume`: see `Netsys_tls.create_file_endpoint`.