@@ -741,12 +741,9 @@ server. If `tlsSocket.authorized` is `false`, then `socket.authorizationError` |
741 | 741 | is set to describe how authorization failed. Depending on the settings |
742 | 742 | of the TLS server, unauthorized connections may still be accepted. |
743 | 743 |
|
744 | | -The `tlsSocket.alpnProtocol` property is a string that contains the selected |
745 | | -ALPN protocol. When ALPN has no selected protocol because the client or the |
746 | | -server did not send an ALPN extension, `tlsSocket.alpnProtocol` equals `false`. |
747 | | - |
748 | | -The `tlsSocket.servername` property is a string containing the server name |
749 | | -requested via SNI. |
| 744 | +The [`tls.TLSSocket.servername`][] and [`tls.TLSSocket.alpnProtocol`][] |
| 745 | +properties can be used to check which server name was requested, and which |
| 746 | +protocol was negotiated. |
750 | 747 |
|
751 | 748 | ### Event: `'tlsClientError'` |
752 | 749 |
|
@@ -1043,6 +1040,18 @@ Returns the bound `address`, the address `family` name, and `port` of the |
1043 | 1040 | underlying socket as reported by the operating system: |
1044 | 1041 | `{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. |
1045 | 1042 |
|
| 1043 | +### `tlsSocket.alpnProtocol` |
| 1044 | + |
| 1045 | +<!-- YAML |
| 1046 | +added: v6.0.0 |
| 1047 | +--> |
| 1048 | + |
| 1049 | +* Type: {string|boolean|null} |
| 1050 | + |
| 1051 | +The negotiated ALPN protocol. This is `null` before the handshake completes. |
| 1052 | +Once the handshake completes, it settles as either the negotiated protocol |
| 1053 | +name, or `false` if the peers did not negotiate an ALPN protocol. |
| 1054 | + |
1046 | 1055 | ### `tlsSocket.authorizationError` |
1047 | 1056 |
|
1048 | 1057 | <!-- YAML |
@@ -1570,6 +1579,18 @@ When running as the server, the socket will be destroyed with an error after |
1570 | 1579 | For TLSv1.3, renegotiation cannot be initiated, it is not supported by the |
1571 | 1580 | protocol. |
1572 | 1581 |
|
| 1582 | +### `tlsSocket.servername` |
| 1583 | + |
| 1584 | +<!-- YAML |
| 1585 | +added: v0.11.3 |
| 1586 | +--> |
| 1587 | + |
| 1588 | +* Type: {string|boolean|null} |
| 1589 | + |
| 1590 | +The SNI (Server Name Indication) host name associated with the socket. This is |
| 1591 | +`null` before the handshake completes. Once the handshake completes it settles |
| 1592 | +as either the host name string, or `false` if SNI was not used. |
| 1593 | + |
1573 | 1594 | ### `tlsSocket.setKeyCert(context)` |
1574 | 1595 |
|
1575 | 1596 | <!-- YAML |
@@ -2544,11 +2565,13 @@ added: v0.11.3 |
2544 | 2565 | [`tls.DEFAULT_MAX_VERSION`]: #tlsdefault_max_version |
2545 | 2566 | [`tls.DEFAULT_MIN_VERSION`]: #tlsdefault_min_version |
2546 | 2567 | [`tls.Server`]: #class-tlsserver |
| 2568 | +[`tls.TLSSocket.alpnProtocol`]: #tlssocketalpnprotocol |
2547 | 2569 | [`tls.TLSSocket.enableTrace()`]: #tlssocketenabletrace |
2548 | 2570 | [`tls.TLSSocket.getPeerCertificate()`]: #tlssocketgetpeercertificatedetailed |
2549 | 2571 | [`tls.TLSSocket.getProtocol()`]: #tlssocketgetprotocol |
2550 | 2572 | [`tls.TLSSocket.getSession()`]: #tlssocketgetsession |
2551 | 2573 | [`tls.TLSSocket.getTLSTicket()`]: #tlssocketgettlsticket |
| 2574 | +[`tls.TLSSocket.servername`]: #tlssocketservername |
2552 | 2575 | [`tls.TLSSocket`]: #class-tlstlssocket |
2553 | 2576 | [`tls.connect()`]: #tlsconnectoptions-callback |
2554 | 2577 | [`tls.createSecureContext()`]: #tlscreatesecurecontextoptions |
|