ip.get_address_info

Synopsis

local ip = require "ip"

ip.tcp.get_address_info()
ip.tcp.get_address_v4_info()
ip.tcp.get_address_v6_info()
ip.udp.get_address_info()
ip.udp.get_address_v4_info()
ip.udp.get_address_v6_info()

function(host: string|ip.address, service: string|integer[, flags: integer])
    -> { address: ip.address, port: integer, canonical_name: string|nil }[]

Description

Forward-resolves host and service into a list of endpoint entries. Current fiber is suspended until operation finishes.

flags is 0 or an or-combination of values from ip.address_info_flag(3em).

If no flags are passed to this function (i.e. flags is nil) then this function will follow the glibc defaults even on non-glibc systems: bit.bor(address_configured,v4_mapped).

Returns a list of entries. Each entry will be a table with the following members:

  • address: ip.address.

  • port: integer.

If ip.address_info_flag.canonical_name is passed in flags then each entry will also include:

  • canonical_name: string.

If host is an ip.address then no host name resolution should be attempted.

If service is a number then no service name resolution should be attempted.