new Agent([options])
历史
版本 | 变化 |
---|---|
v12.5.0 | 如果目标主机是使用 IP 地址指定的,则不会自动设置 servername。 |
参数
options
<Object>要在代理上设置的一组可配置选项。可以具有与 for 相同的字段new Agent([options]), 和-
maxCachedSessions
<number> TLS 缓存会话的最大数量。使用0
禁用 TLS 会话缓存。 默认:100
。 -
servername
<string> Server Name Indication extension 的值要发送到服务器。使用空字符串''
禁用发送扩展。 默认: 目标服务器的主机名,除非使用 IP 地址指定目标服务器,在这种情况下默认为''
(无扩展名)。有关 TLS 会话重用的信息,请参阅
Session Resumption
-
事件:'keylog'
#
添加于:v13.2.0、v12.16.0
line
<Buffer> ASCII 文本行,NSSSSLKEYLOGFILE
格式。tlsSocket
<tls.TLSSocket> 生成它的tls.TLSSocket
实例。
keylog
事件在此代理管理的连接生成或接收 key 材料时发出(通常在握手完成之前,但不一定)。可以存储此 key 材料以进行调试,因为它允许对捕获的 TLS 流量进行解密。它可能会为每个套接字发出多次。
一个典型的用例是将接收到的行附加到一个通用文本文件中,稍后软件(例如 Wireshark)使用该文件来解密流量:
// ...
https.globalAgent.on('keylog', (line, tlsSocket) => {
fs.appendFileSync('/tmp/ssl-keys.log', line, { mode: 0o600 });
});
相关用法
- Node.js new Agent([options])用法及代码示例
- Node.js new AsyncResource(type[, options])用法及代码示例
- Node.js new assert.AssertionError(options)用法及代码示例
- Node.js new stream.Duplex(options)用法及代码示例
- Node.js new stream.Readable([options])用法及代码示例
- Node.js new Console(options)用法及代码示例
- Node.js new URLSearchParams(obj)用法及代码示例
- Node.js new crypto.Certificate()用法及代码示例
- Node.js new stream.Writable([options])用法及代码示例
- Node.js new URLSearchParams(iterable)用法及代码示例
- Node.js new vm.SourceTextModule(code[, options])用法及代码示例
- Node.js new stream.Transform([options])用法及代码示例
- Node.js new PerformanceObserver(callback)用法及代码示例
- Node.js new URL(input[, base])用法及代码示例
- Node.js new URLSearchParams(string)用法及代码示例
- Node.js new assert.CallTracker()用法及代码示例
- Node.js net.isIP(input)用法及代码示例
- Node.js net.createConnection(options[, connectListener])用法及代码示例
- Node.js net.isIPv6(input)用法及代码示例
- Node.js net.Server.address()用法及代码示例
- Node.js net.createServer([options][, connectionListener])用法及代码示例
- Node.js net.Server.listen()用法及代码示例
- Node.js net.Socket.setTimeout(timeout[, callback])用法及代码示例
- Node.js net.BlockList.check(address[, type])用法及代码示例
- Node.js net.isIPv4(input)用法及代码示例
注:本文由纯净天空筛选整理自nodejs.org大神的英文原创作品 new Agent([options])。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。