bluecatengineering / dora

A Rust DHCP server
Mozilla Public License 2.0
448 stars 12 forks source link

API for Embedding in another App? #48

Open TheColonel2688 opened 7 months ago

TheColonel2688 commented 7 months ago

Sorry it doesn't look like Discussions are enabled on this repo.

I am looking to learn rust, and I thought a good little project would be a Temporary/short-lived DHCP Server GUI Utility. Use case is inital provisioning of IoT and Industrial Automation Devices, many of which come with DHCP enable out of box.

Looking at this repo, I don't see any documentation for using dora in another application, it seems to only be a standalone CLI app using yaml for configuration.

It is possible to use it in another app directly? If so where is the documentation for that API?

stappersg commented 7 months ago

On Sat, Feb 10, 2024 at 06:57:45AM -0800, TheColonel2688 wrote:

Looking at this repo ....

@.:~ $ cd src/rust/dora/ @.:~/src/rust/dora $ grep dhcp Cargo.toml dhcproto = "0.9.0" @.***:~/src/rust/dora $

http://www.catb.org/esr/faqs/smart-questions.html

And still feel welcome.

TheColonel2688 commented 6 months ago

It seems like you are being a smart ass and directing me to dhcproto, but I already looked at that repo and it is just a encoder/decorder as for as I can tell, not a server with an API.

I am looking for a server library with an API. That will give me a list of client MACs, and associated IP Address, then let me over override the leased IPaddress for a specific MAC.

I suppose I could impliment that myself on top of dhcproto, but I was hoping such features already existed.

leshow commented 6 months ago

Please, no need to resort to name calling. On the topic of your question, no such public API exists. You may be able to get by with just reading the sqlite database that dora uses. Another option would be to implement a "plugin" for dora, dora's functionality is split between a core server library that handles reading and writing to a socket and a kind of middleware stack that implements the rest. The core libraries are not in public crates, however, so you'd be forking the repo to add what you need.

If you end up working on this, I'd consider merging it. Perhaps a new optional plugin that writes state changes to a unix socket or something. If you're interested we can discuss further.

I will see if I can open the discussions section.