有没有办法可以设置 DNS 请求绑定到的网络接口。
我们有一个项目,需要使用高优先级流会话通过一个接口,而所有其他请求通过第二个接口传递。
示例:设置“eth0”,以便所有 ares 请求将通过“eth0”而不是“wlan0”。
我无法在 c-ares 中找到任何提供此设置界面选项的 API(在 ares_init_options() API 中)。
如果有什么方法可以实现这一点或者我错过了什么,请告诉我。
谢谢,
阿琼
如果您有一个相当新的 c-ares (c-ares >= 1.7.4),请查看 ares.h (这是我实际发现它引用的唯一地方)。
/* These next 3 configure local binding for the out-going socket
* connection. Use these to specify source IP and/or network device
* on multi-homed systems.
*/
CARES_EXTERN void ares_set_local_ip4(ares_channel channel, unsigned int local_ip);
/* local_ip6 should be 16 bytes in length */
CARES_EXTERN void ares_set_local_ip6(ares_channel channel,
const unsigned char* local_ip6);
/* local_dev_name should be null terminated. */
CARES_EXTERN void ares_set_local_dev(ares_channel channel,
const char* local_dev_name);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)