Hi.
I think it will be better if the bootstrapping process is able to resolve the resolver host ("dns.google") directly from system hosts file. Since the most popular public DoH providers have fixed IPs for their service domains, it is often beneficial to add these records to hosts file to speed up initialization.
Currently, ares_gethostbyname does not consult the system hosts file, always sending query to the bootstrap DNS server.
To make c-ares use hosts file, when initializing c-ares using ares_init_options(), the char* lookups option of struct ares_options should be set to fb, which means consult the hosts file first, then resolve using DNS servers.
See: https://man.archlinux.org/man/ares_init_options.3.en#ARES_OPT_LOOKUPS
Hi.
I think it will be better if the bootstrapping process is able to resolve the resolver host ("dns.google") directly from system hosts file. Since the most popular public DoH providers have fixed IPs for their service domains, it is often beneficial to add these records to hosts file to speed up initialization.
Currently,
ares_gethostbynamedoes not consult the system hosts file, always sending query to the bootstrap DNS server.To make c-ares use hosts file, when initializing c-ares using
ares_init_options(), thechar* lookupsoption ofstruct ares_optionsshould be set tofb, which means consult the hosts file first, then resolve using DNS servers.See: https://man.archlinux.org/man/ares_init_options.3.en#ARES_OPT_LOOKUPS