webmeshproj / webmesh

A simple, distributed, zero-configuration WireGuard mesh solution
https://webmeshproj.github.io
Apache License 2.0
420 stars 16 forks source link

Feature request: Embedded Targets Support #1

Closed TimDowker closed 1 year ago

TimDowker commented 1 year ago

Would it be possible to get a binary compiled for the MIPS CPU arch? I would like to use this on some TP-Link Archer C7 routers and they have a MIPSLE CPU arch. Thank you

tinyzimmer commented 1 year ago

I need to get rid of the CGO before this will be possible. I don't know if I tested on that specific architecture - but I tried a few other embedded targets and they all crapped out on me. The SQLite is holding us back :stuck_out_tongue: .

I'm limited to what the go-sqlite bindings support at the moment. I'd happily switch to a CGO free implementation, but a good chunk of the code is generated by sqlc at the moment and I'd need to wait until they support one for sqlite. We could use modernc but it doesn't expose enough lower-level stuff (most notably Serialization/Deserialization) so would have to fork. The alternative I guess is no generated code...or me jumping into sqlc and taking a shot at a full driver myself.

Another idea is to switch to an embedded key-value store of some kind. But I'm kinda digging having the mesh state in SQL format. If enough benefits to that don't materialize then ditching SQL would make cross-compilation smoother as well.

tinyzimmer commented 1 year ago

I actually just took a shot at it to see what other issues might arise on MIPS - it appears the boltdb library I'm using for the raft storage is not playing nice either. So that's another area that needs more investigation.

tinyzimmer commented 1 year ago

After some thought on this - I think I am going to attempt a redesign based off BadgerDB. This won't be a small undertaking, but better sooner to consider this than later when the project is more mature.

This would enable most embedded use cases down the line. I'll keep this thread updated as it progresses.

tinyzimmer commented 1 year ago

The latest release has what we'll call "experimental" support for embedded targets such as MIPS. Quite a few things have changed so I expect to have to iron out some plumbing.

Closing this issue, but feel free to create new ones for any bugs you encounter.