bluecatengineering / dora

A Rust DHCP server
Mozilla Public License 2.0
437 stars 10 forks source link

[general question] listing dhcp leases #52

Open patanne opened 3 months ago

patanne commented 3 months ago

I just stumbled across this project and am extremely interested. Is there a CLI to query the current leases or should we be hitting the SQL database directly? Side note. I saw the API request for lease info. That is clearly of interest as it is applicable here.

With our existing tools we keep two lists. Dynamic leases and static (reserved). We treat them differently for measuring lease block/range saturation. Looking at the migrations there is no field that flags dynamic vs static. Will we be able to get that info without having to cross reference the config file?

leshow commented 2 months ago

Right now you have to talk to sqlite directly for dynamic leases and the config file for static leases.

If this is of interest to more than one person, I'll try to add it soon. If we had /leases/static and /leases/dynamic as an endpoint you could curl, would that work?

patanne commented 2 months ago

that would be absolutely perfect for me.

patanne commented 2 months ago

thinking about this further, if we had just one endpoint /leases, that would be adequate so long as what was returned had a field indicating whether it was reserved or not.

leshow commented 2 months ago

That sounds fine, I've got a draft started for this currently unfinished. We may as well add a /config endpoint or something to fetch the current config while we're at it.