支持的 getaddrinfo


以下标志可以作为提示传给 dns.lookup()

  • dns.ADDRCONFIG: 将返回的地址类型限制为系统上配置的非环回地址类型。 例如,仅当当前系统至少配置了一个 IPv4 地址时,才会返回 IPv4 地址。
  • dns.V4MAPPED: 如果指定了 IPv6 族,但未找到 IPv6 地址,则返回 IPv4 映射的 IPv6 地址。 某些操作系统(例如 FreeBSD 10.1)不支持它。
  • dns.ALL: 如果指定了 dns.V4MAPPED,则返回解析的 IPv6 地址以及 IPv4 映射的 IPv6 地址。

The following flags can be passed as hints to dns.lookup().

  • dns.ADDRCONFIG: Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are only returned if the current system has at least one IPv4 address configured.
  • dns.V4MAPPED: If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported on some operating systems (e.g FreeBSD 10.1).
  • dns.ALL: If dns.V4MAPPED is specified, return resolved IPv6 addresses as well as IPv4 mapped IPv6 addresses.