-
Notifications
You must be signed in to change notification settings - Fork 922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dnsdist: provide an easy way to flush a cache by domain & RR type #10468
Comments
wrt the comment about lua defeating me, after IRC enlightenment. The c++ for @Habbie explains that the c++ function returns void/nil and not the
It would be trivial to change this so that the function also returns something |
Seems like a duplicated of #6154, except with a nice piece of Lua as a work-around :-) For what it's worth, I think we should consider adding this to the API for 1.7.0, since the v2 of the API has not made any progress. |
A more generic option might be useful for extending via lua in general #10480 for that. |
Hi, @dch I would like to try your work at my setup, but since I am a Lua noob I couldn't figure out myself, how do you make this function be called actually 😓 since there is still time for 1.8.0 I tought I could use this code for now. |
@callMe-Root let's move this out of the issue. https://gist.github.com/dch/6f4fe79db178393130346719e7dff6ff is as much of the config as I can share, and a usage example. You need to create the hashed API key via dnsdist console, but the rest is basically copy-pasta to the end of your existing config. BTW this is the first lua I wrote, so the learning bar is reasonably low here. |
you can workaround with this solution: -- save current cache entries getPool(""):getCache():expungeByName(name, DNSQType.ANY, true) -- save cache entries after clear -- total cache entries flushed |
Implemented in #12473. |
how to expose lua functions over HTTP API?
Usecase
getPool(""):GetCache():expungeByName(...)
Description
The actual method/url/response etc is not important, this is just an example:
Actually you can already do 90% of this in lua
I did actually succeed in doing this with lua (thanks IRC folks) already, but I may have "deviated somewhat from acceptable HTTP usage". This was necessary because:
GET
methods return405 Invalid Method
this produces the following output in the console:
This was so incredibly easy & fun, I really hope we can find more ways (methods!) to extend dnsdist, this was a great friday afternoon hack.
The text was updated successfully, but these errors were encountered: