c-ares specifying network interface for the DNS resolves

后端 未结 1 806
耶瑟儿~
耶瑟儿~ 2021-01-25 18:30

Is there a way in which you can set the network interface to which the DNS requests can be bound to.

We have a project which requires to use a highpriority streaming ses

1条回答
  •  别那么骄傲
    2021-01-25 18:36

    If you have a fairly new c-ares (c-ares >= 1.7.4), check out ares.h (It's the only place I've actually found it referenced).

    /* 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);
    

    0 讨论(0)
提交回复
热议问题