Skip to content

Add simple dns lookup function to cqueues.dns #164

Description

@daurnimator

It can be complex figuring out how to do a 'normal' dns query.

e.g. to lookup an ip for google.com, you currently need something like:

local dns = require "cqueues.dns"
local host = "google.com"
local res, err, errno = dns.query(host)
if not res then return nil, err, errno end
local ip
for rec in res:grep{section = "answer", type = "A", class = "IN", name = host .. "."} do
    ip = rec:addr()
    break
end
if ip then
    return ip
else
    return nil, "not found"
end

Add a simpler interface.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions