Skip to content

Consult the system hosts file when bootstrapping #187

@sagan

Description

@sagan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions