3 Matching Annotations
  1. Jul 2023
  2. Jun 2023
    1. By default the pure Go resolver is used, because a blocked DNS request consumes only a goroutine, while a blocked C call consumes an operating system thread. When cgo is available, the cgo-based resolver is used instead under a variety of conditions: on systems that do not let programs make direct DNS requests (OS X), when the LOCALDOMAIN environment variable is present (even if empty), when the RES_OPTIONS or HOSTALIASES environment variable is non-empty, when the ASR_CONFIG environment variable is non-empty (OpenBSD only), when /etc/resolv.conf or /etc/nsswitch.conf specify the use of features that the Go resolver does not implement, and when the name being looked up ends in .local or is an mDNS name.

      Whenever go detects an attempt has been made by the sysadmin to customize the behaviour of the DNS resolver, by setting the given ENV variables such ad RES_OPTIONS, it uses the resolver provided by the OS or sysadmin instead of the pure Go resolver.