Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ConnectOptions

Hierarchy

  • ConnectOptions

Index

Properties

Optional ALPNProtocols

ALPNProtocols: string[] | Buffer[]

An array of strings or Buffers containing the supported ALPN protocols. Buffers should have the format [len][name][len][name]... e.g. 0x05hello0x05world, where the first byte is the length of the next protocol name. Passing an array is usually much simpler: ['hello', 'world'].)

Optional NPNProtocols

NPNProtocols: string[] | Buffer[]

An array of strings or Buffers containing supported NPN protocols. Buffers should have the format [len][name][len][name]... e.g. 0x05hello0x05world, where the first byte is the length of the next protocol name. Passing an array is usually much simpler, e.g. ['hello', 'world'].

Optional ca

ca: string | Buffer | string[] | Buffer[]

A string, Buffer, array of strings, or array of Buffers of trusted certificates in PEM format. If this is omitted several well known "root" CAs (like VeriSign) will be used. These are used to authorize connections.

Optional cert

cert: string | Buffer | string[] | Buffer[]

A string, Buffer, array of strings, or array of Buffers containing the certificate key of the client in PEM format.

Optional checkServerIdentity

checkServerIdentity: function

A callback function to be used when checking the server's hostname against the certificate. This should throw an error if verification fails. The method should return undefined if the servername and cert are verified.

Type declaration

    • (servername: string, cert: Buffer): void
    • Parameters

      • servername: string
      • cert: Buffer

      Returns void

Optional ciphers

ciphers: string

A string describing the ciphers to use or exclude, separated by :. Uses the same default cipher suite as tls.createServer().

Optional host

host: string

Host the client should connect to.

Optional key

key: string | Buffer | string[] | Buffer[]

A string, Buffer, array of strings, or array of Buffers containing the private key of the client in PEM format.

Optional minDHSize

minDHSize: number

Minimum size of the DH parameter in bits to accept a TLS connection. When a server offers a DH parameter with a size less than minDHSize, the TLS connection is destroyed and an error is thrown. Defaults to 1024.

Optional passphrase

passphrase: string

A string containing the passphrase for the private key or pfx.

Optional path

path: string

Creates unix socket connection to path. If this option is specified, host and port are ignored.

Optional pfx

pfx: string | Buffer

A string or Buffer containing the private key, certificate, and CA certs of the client in PFX or PKCS12 format.

Optional port

port: number | string

Port the client should connect to.

Optional rejectUnauthorized

rejectUnauthorized: boolean

If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails; err.code contains the OpenSSL error code. Defaults to true.

Optional secureContext

secureContext: SecureContext

An optional TLS context object as returned by from tls.createSecureContext( ... ). It can be used for caching client certificates, keys, and CA certificates.

Optional secureProtocol

secureProtocol: string

The SSL method to use, e.g., SSLv3_method to force SSL version 3. The possible values depend on the version of OpenSSL installed in the environment and are defined in the constant SSL_METHODS.

Optional servername

servername: string

Server name for the SNI (Server Name Indication) TLS extension.

Optional session

session: Buffer

A Buffer instance, containing TLS session.

Optional socket

socket: Socket

Establish secure connection on a given socket rather than creating a new socket. If this option is specified, host and port are ignored.

Generated using TypeDoc