事件:'secureConnection'
¥Event: 'secureConnection'
'secureConnection'
事件在新连接的握手过程成功完成后触发。监听器回调在调用时传入一个参数:
¥The 'secureConnection'
event is emitted after the handshaking process for a
new connection has successfully completed. The listener callback is passed a
single argument when called:
-
tlsSocket
<tls.TLSSocket> 已建立的 TLS 套接字。¥
tlsSocket
<tls.TLSSocket> The established TLS socket.
tlsSocket.authorized
属性是一个 boolean
,指示客户端是否已通过服务器提供的证书颁发机构之一进行验证。如果 tlsSocket.authorized
为 false
,则设置 socket.authorizationError
来描述授权失败的方式。根据 TLS 服务器的设置,可能仍会接受未经授权的连接。
¥The tlsSocket.authorized
property is a boolean
indicating whether the
client has been verified by one of the supplied Certificate Authorities for the
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.
tlsSocket.alpnProtocol
属性是包含所选 ALPN 协议的字符串。当 ALPN 没有选择协议时,tlsSocket.alpnProtocol
等于 false
。
¥The tlsSocket.alpnProtocol
property is a string that contains the selected
ALPN protocol. When ALPN has no selected protocol, tlsSocket.alpnProtocol
equals false
.
tlsSocket.servername
属性是包含通过 SNI 请求的服务器名称的字符串。
¥The tlsSocket.servername
property is a string containing the server name
requested via SNI.