naggie / dsnet

FAST command to manage a centralised wireguard VPN. Think wg-quick but quicker: key generation + address allocation.
https://calbryant.uk/blog/how-to-set-up-a-wireguard-vpn-in-minutes-with-dsnet/
MIT License
673 stars 33 forks source link

Split out dsnet in to lib and cli #59

Closed botto closed 2 years ago

botto commented 3 years ago

This PR suggest to split out the lib and cli so it's easier for other implementations to use dsnet as a lib and not worry about cli features causing unexpected exits.

For now this will be a draft to get some initial feedback but also while I work on converting the other commands

naggie commented 2 years ago

Thanks -- thoughts:

Generally a good idea, dsnet CLI using dsnet as a lib means we're unlikely to make bad choices or side affects that impact other applications.

botto commented 2 years ago

Hi @naggie Sorry for the long delay on this and the size the PR has grown to, I've done some more work on this since you last checked:

botto commented 2 years ago

My thought was to merge these as the CLI as a whole is working, so it's backwards compatible (but please do test if you have a chance, I might have missed something). Then I'll move report and remove over as well. Trying to avoid this become more of a monster PR

botto commented 2 years ago

Re util and config:

The config in the CLI is related to the json file handling, so this would only every be part of the CLI, if something else wants to also store it's config in json then maybe we could split it out in to it's own package. Eventually the plan is to have the abstract store which the CLI could use and or other tools (i.e. dsnet-gui) could also use

The util is just for helpers to work with the CLI