agent.getName([options])


  • options <Object> 一组用于名称生成的信息选项
    • host <string> 要发出请求的服务器的域名或IP地址
    • port <number> 远程服务器的端口
    • localAddress <string> 发起请求时用于网络连接的本地绑定接口
    • family <integer> 如果不等于 undefined,必须为4或6。
  • 返回:<string>

为一组请求选项获取一个唯一名称,以确定连接是否可以重用。对于 HTTP 代理,这会返回 host:port:localAddresshost:port:localAddress:family。对于 HTTPS 代理,名称包括 CA、证书、加密套件以及其他决定套接字可重用性的 HTTPS/TLS 特定选项。

【Get a unique name for a set of request options, to determine whether a connection can be reused. For an HTTP agent, this returns host:port:localAddress or host:port:localAddress:family. For an HTTPS agent, the name includes the CA, cert, ciphers, and other HTTPS/TLS-specific options that determine socket reusability.】