-- LuaJIT ffi bindings for libkres, a DNS resolver library.
-- @note Since it's statically compiled, it expects to find the symbols in the C namespace.
-local ffi_ok
-ffi_ok, ffi = pcall(require, 'ffi')
-if not ffi_ok then
- local M = { error = 'FFI not available, resolver bindings disabled.' }
- setmetatable(M, {__index = function(t,k,v) error(rawget(M, 'error')) end })
- return M
-end
+ffi = require('ffi')
local bit = require('bit')
local bor = bit.bor
local band = bit.band
return rr
end
--- Load the module (check for FFI)
-local ffi_ok, ffi = pcall(require, 'ffi')
-if not ffi_ok then
- -- Simplified TA management, no RFC5011 automatics
- return {
- -- Reuse Lua/C global function
- add = trustanchor,
- -- Simplified trust anchor management
- config = function (path)
- if not path then return end
- if not io.open(path, 'r') then
- local rr, err = bootstrap()
- if not rr then print(err) return false end
- local keyfile = assert(io.open(path, 'w'))
- keyfile:write(rr..'\n')
- end
- for line in io.lines(path) do
- trustanchor(line)
- end
- end,
- -- Disabled
- set_insecure = function () error('[ ta ] FFI not available, this function is disabled') end,
- }
-end
+-- Load the module
+local ffi = require 'ffi'
local kres = require('kres')
local C = ffi.C
local kres = require('kres')
local bit = require('bit')
+local ffi = require('ffi')
-- Counter of unique rules
local nextid = 0
return s
end
end
-local has_ffi, ffi = pcall(require, 'ffi')
-if not has_ffi then
- socket_client = function () return error("missing ffi library, required for this policy") end
-end
local function parse_target(target)
local addr, port = target:match '([^@]*)@?(.*)'