The CLI is simple, but parses config files and communicates over the network
with arbitrary endpoints.
Limit system operations to that is needed before doing anything and drop all
priviledges after config file and socket handling is done, i.e. do parse and
speak over the network completely unprivileged.
This PR updates Ironwood to include the new RTT-based link costing and
updates `yggdrasilctl` to report the cost in `getPeers`.
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
This refactors the request parsing, as well as improving the output for some request types. It also tweaks `yggdrasilctl` output, which should help with #947.
* Move yggdrasilctl responses to separate functions
* Move yggdrasilctl request switch to separate function
* Add empty lines
* Create struct CmdLine for yggdrasilctl
* Move yggdrasilctl command line parsing to separate func
* Turn struct CmdLine into CmdLineEnv
* Rename func parseCmdLine to parseFlagsAndArgs
* Move yggdrasilctl endpoint setting logic into separate func
* Function to create yggdrasilctl CmdLineEnv
* Reorder code
* Move struct fields into lines
* Turn yggdrasilctl CmdLineEnv funcs to methods
* Move yggdrasilctl connection code to separate func
* Rename functions
* Move yggdrasilctl command line env to separate mod
* Move yggdrasilctl command line env to main mod
* Run goimports
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>