我有多个具有不同 IP 地址的网络接口(interface)。如何使用 node.js 模块 request ( https://github.com/mikeal/request ) 通过这些 IP 向站点发出 http 请求?
最佳答案
在 nodejs http
模块中,有一个 localAddress
选项可以与 http.request()
一起使用.
localAddress
: Local interface to bind for network connections.
我没有使用过你提到的模块,但如果它只是将选项传递给 http
模块,我看不出它不工作的原因。
关于使用网络接口(interface)的 node.js HTTP 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15773672/