Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions doc/api/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,12 +741,9 @@ server. If `tlsSocket.authorized` is `false`, then `socket.authorizationError`
is set to describe how authorization failed. Depending on the settings
of the TLS server, unauthorized connections may still be accepted.

The `tlsSocket.alpnProtocol` property is a string that contains the selected
ALPN protocol. When ALPN has no selected protocol because the client or the
server did not send an ALPN extension, `tlsSocket.alpnProtocol` equals `false`.

The `tlsSocket.servername` property is a string containing the server name
requested via SNI.
The [`tls.TLSSocket.servername`][] and [`tls.TLSSocket.alpnProtocol`][]
properties can be used to check which server name was requested, and which
protocol was negotiated.

### Event: `'tlsClientError'`

Expand Down Expand Up @@ -1043,6 +1040,18 @@ Returns the bound `address`, the address `family` name, and `port` of the
underlying socket as reported by the operating system:
`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`.

### `tlsSocket.alpnProtocol`

<!-- YAML
added: v6.0.0
-->

* Type: {string|boolean|null}

The negotiated ALPN protocol. This is `null` before the handshake completes.
Once the handshake completes, it settles as either the negotiated protocol
name, or `false` if the peers did not negotiate an ALPN protocol.

### `tlsSocket.authorizationError`

<!-- YAML
Expand Down Expand Up @@ -1570,6 +1579,18 @@ When running as the server, the socket will be destroyed with an error after
For TLSv1.3, renegotiation cannot be initiated, it is not supported by the
protocol.

### `tlsSocket.servername`

<!-- YAML
added: v0.11.3
-->

* Type: {string|boolean|null}

The SNI (Server Name Indication) host name associated with the socket. This is
`null` before the handshake completes. Once the handshake completes it settles
as either the host name string, or `false` if SNI was not used.

### `tlsSocket.setKeyCert(context)`

<!-- YAML
Expand Down Expand Up @@ -2553,11 +2574,13 @@ added: v0.11.3
[`tls.DEFAULT_MAX_VERSION`]: #tlsdefault_max_version
[`tls.DEFAULT_MIN_VERSION`]: #tlsdefault_min_version
[`tls.Server`]: #class-tlsserver
[`tls.TLSSocket.alpnProtocol`]: #tlssocketalpnprotocol
[`tls.TLSSocket.enableTrace()`]: #tlssocketenabletrace
[`tls.TLSSocket.getPeerCertificate()`]: #tlssocketgetpeercertificatedetailed
[`tls.TLSSocket.getProtocol()`]: #tlssocketgetprotocol
[`tls.TLSSocket.getSession()`]: #tlssocketgetsession
[`tls.TLSSocket.getTLSTicket()`]: #tlssocketgettlsticket
[`tls.TLSSocket.servername`]: #tlssocketservername
[`tls.TLSSocket`]: #class-tlstlssocket
[`tls.connect()`]: #tlsconnectoptions-callback
[`tls.createSecureContext()`]: #tlscreatesecurecontextoptions
Expand Down
Loading