a TLS connection

interface ITlsConnection {
    close: () => void;
    getAlpnProtocol: () => null | string;
    localAddress: null | TcpEndpoint;
    read: (into: Uint8Array) => Promise<number>;
    remoteAddress: null | TcpEndpoint;
    setKeepAlive: (keepAlive: boolean) => void;
    setNoDelay: (noDelay: boolean) => void;
    write: (bytes: Uint8Array) => Promise<void>;
}

Hierarchy (View Summary)

Implemented by

Properties

close: () => void

Close the underlying source.

getAlpnProtocol: () => null | string

get the ALPN protocol that was negotiated in the handshake

localAddress: null | TcpEndpoint

local address of the connection (if available)

read: (into: Uint8Array) => Promise<number>

Read data from the underlying source into the provided Uint8Array, up to the length of the array, and return the number of bytes read.

If there are no bytes available currently, the implementation is supposed to wait until at least one byte is available, and only then resolve the promise. Resolving the promise with a zero-length Uint8Array is marking the end of the source.

Type declaration

    • (into: Uint8Array): Promise<number>
    • Parameters

      • into: Uint8Array

      Returns Promise<number>

      Uint8Array containing the bytes that were read.

remoteAddress: null | TcpEndpoint

remote address of the connection (if available)

setKeepAlive: (keepAlive: boolean) => void

set keep-alive flag on the connection

setNoDelay: (noDelay: boolean) => void

set no-delay flag on the connection

write: (bytes: Uint8Array) => Promise<void>

Write bytes to the underlying stream, resolving once the write is complete