[英]How to randomly choose the outgoing address from an IPv6 pool using Node.JS?
I'm trying to create and run a Node.JS proxy in a machine that has a pool of IPv6 addresses. 我正在尝试在具有IPv6地址池的计算机上创建并运行Node.JS代理。 I want the proxy to randomly choose one of these addresses for each request (making it difficult for the websites to track record of users' requests).
我希望代理为每个请求随机选择这些地址之一(这使网站很难跟踪用户请求的记录)。
With wget I can achieve this by using the attribute --bind-address as following: 使用wget,我可以通过使用--bind-address属性来实现此目的,如下所示:
wget --bind-address OUTGOING_IP http://www.example.com/
Is there any way to achieve the same behavior using Node.JS? 有什么方法可以使用Node.JS实现相同的行为吗?
If you want to make outbound HTTP requests from different IPs, have a look for "localAddress" option under "http.request": 如果要从不同的IP发出出站HTTP请求,请在“ http.request”下查找“ localAddress”选项:
http://nodejs.org/docs/latest/api/http.html#http_http_request_options_callback http://nodejs.org/docs/latest/api/http.html#http_http_request_options_callback
If you want to start a TCP server to listen on a particular IP bound to your host, you would probably want to specify it when you create the server [ie server.listen(PORT, HOST)]: 如果要启动TCP服务器以侦听绑定到主机的特定IP,则可能需要在创建服务器时指定它[即server.listen(PORT,HOST)]:
http://nodejs.org/docs/latest/api/net.html#net_class_net_server http://nodejs.org/docs/latest/api/net.html#net_class_net_server
-- ab1 -ab1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.