事件:'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.authorized 属性是一个 boolean,用于指示客户端是否已通过服务器提供的某个证书颁发机构进行验证。如果 tlsSocket.authorizedfalse,则 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 because the client or the server did not send an ALPN extension, tlsSocket.alpnProtocol equals false.】

tlsSocket.servername 属性是一个字符串,包含通过 SNI 请求的服务器名称。

【The tlsSocket.servername property is a string containing the server name requested via SNI.】