forked from dmachard/dnsdist-config-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmiscs_ffi_requestorid.lua
More file actions
24 lines (19 loc) · 819 Bytes
/
miscs_ffi_requestorid.lua
File metadata and controls
24 lines (19 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- listen on localhost
setLocal("0.0.0.0:53", {})
-- init backend
newServer({address = "1.1.1.1:53", pool="default"})
-- init remote logger
pl = newRemoteLogger("192.168.1.6:6000")
local ffi = require("ffi")
function luaffiactionsetrequestorid(dq)
local currentRequestor= "forbar"
ffi.C.dnsdist_ffi_dnsquestion_set_requestor_id(dq, currentRequestor, #currentRequestor)
return DNSAction.None
end
-- rules for queries
addAction(AllRule(), LuaFFIAction(luaffiactionsetrequestorid))
addAction(AllRule(), RemoteLogAction(pl, nil, {serverID="dnsdist"}))
addAction( AllRule(), PoolAction("default"))
-- rules for replies
addResponseAction(AllRule(), RemoteLogResponseAction(pl, nil, true, {serverID="dnsdist"}))
addCacheHitResponseAction(AllRule(), RemoteLogResponseAction(pl, nil, true, {serverID="dnsdist"}))