Bun

interface

tls.CommonConnectionOptions

interface CommonConnectionOptions

  • ALPNProtocols?: readonly string[] | ArrayBufferView<ArrayBufferLike>

    An array of strings, or a single Buffer, TypedArray, or DataView containing the supported ALPN protocols. Buffers should have the format [len][name][len][name]... e.g. '\x08http/1.1\x08http/1.0', where the len byte is the length of the next protocol name. Passing an array is usually much simpler, e.g. ['http/1.1', 'http/1.0']. Protocols earlier in the list have higher preference than those later.

  • enableTrace?: boolean

    When enabled, TLS packet trace information is written to stderr. This can be used to debug TLS connection problems.

  • rejectUnauthorized?: boolean

    If true the server will reject any connection which is not authorized with the list of supplied CAs. This option only has an effect if requestCert is true.

  • requestCert?: boolean

    If true the server will request a certificate from clients that connect and attempt to verify that certificate. Defaults to false.

  • secureContext?: SecureContext

    An optional TLS context object from tls.createSecureContext()

  • SNICallback?: (servername: string, cb: (err: null | Error, ctx?: SecureContext) => void) => void

    SNICallback(servername, cb) <Function> A function that will be called if the client supports SNI TLS extension. Two arguments will be passed when called: servername and cb. SNICallback should invoke cb(null, ctx), where ctx is a SecureContext instance. (tls.createSecureContext(...) can be used to get a proper SecureContext.) If SNICallback wasn't provided the default callback with high-level API will be used (see below).