README_ARESOLVER

async_resolver

A library that provides asynchronous dns lookups.

Author: Gunnar Zötl gz@tset.de, 2013-2023.
Released under the terms of the MIT license. See file LICENSE for details.

Introduction

Since version 1.2, lsocket comes with an additional library to do asynchronous dns lookups. It works by spawning a separate thread for each dns lookup and providing functions to check for completion and for fetching the results. This is experimental, and thus not an official part of lsocket, even though it comes with it. Since this is only one function, requiring this library will return a function instead of a table.

Building

As this is not an “official” part of lsocket, it can only be built by editing the Makefile. To build, cd to the src directory and open the Makefile in your favorite editor. Find this:

# swap the comments on the next 2 lines if you want the async resolver to be built and installed also
ALL=lsocket.so
#ALL=lsocket.so async_resolver.so

and change it to this:

# swap the comments on the next 2 lines if you want the async resolver to be built and installed also
#ALL=lsocket.so
ALL=lsocket.so async_resolver.so

then call make or luarocks make.

Using

Load the module with

async_resolve = require "async_resolver"

Constructor

Resolver Methods