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 特定选项。

  • options <Object> A set of options providing information for name generation
    • host <string> A domain name or IP address of the server to issue the request to
    • port <number> Port of remote server
    • localAddress <string> Local interface to bind for network connections when issuing the request
    • family <integer> Must be 4 or 6 if this doesn't equal undefined.
  • Returns: <string>

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.