net/resolvers/manual.lua
author Matthew Wild <mwild1@gmail.com>
Thu, 06 Oct 2022 15:59:07 +0100
changeset 12746 126aefd2c4c6
parent 12593 39ae08180c81
permissions -rw-r--r--
mod_tokenauth: Invalidate tokens issued before most recent password change This is a security improvement, to ensure that sessions authenticated using a token (note: not currently possible in stock Prosody) are invalidated just like password-authenticated sessions are.

local methods = {};
local resolver_mt = { __index = methods };
local unpack = table.unpack;

-- Find the next target to connect to, and
-- pass it to cb()
function methods:next(cb)
	if #self.targets == 0 then
		cb(nil);
		return;
	end
	local next_target = table.remove(self.targets, 1);
	cb(unpack(next_target, 1, 4));
end

local function new(targets, conn_type, extra)
	return setmetatable({
		conn_type = conn_type;
		extra = extra;
		targets = targets or {};
	}, resolver_mt);
end

return {
	new = new;
};