节点替代请求IP解析 [英] Node override request IP resolution
本文介绍了节点替代请求IP解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在努力寻找正确的术语来准确表达此问题,但我将尽我所能:
I'm struggling to find the correct terminology to accurately phrase this problem, but I'm gonna give it my best shot:
在node.js中,有没有办法在发出HTTP请求时手动覆盖IP地址(例如,请求some-domain.com/whatever
,而不是通过DNS解析IP地址,而是手动提供一些IP地址1.2.3.4
)?
In node.js, is there a way to manually override the IP address when making an HTTP request (e.g. request some-domain.com/whatever
and instead of resolving the IP address through DNS, manually provide some IP address 1.2.3.4
) ?
实际上,这相当于在/etc/hosts
推荐答案
有一个微型模块可以完全满足以下要求:邪恶的dns .
There is a tiny module that does exactly that: evil-dns.
evilDns.add('foo.com', '1.2.3.4');
这篇关于节点替代请求IP解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文