diff --git a/add.go b/add.go index 46d86f7..c94b0e0 100644 --- a/add.go +++ b/add.go @@ -2,6 +2,7 @@ package dsnet import ( "os" + "fmt" "text/template" ) @@ -16,6 +17,9 @@ func Add() { //publicKey := MustPromptString("PublicKey (optional)", false) ConfirmOrAbort("\nDo you want to add the above configuration?") + // newline (not on stdout) to separate config + fmt.Fprintln(os.Stderr) + privateKey := GenerateJSONPrivateKey() publicKey := privateKey.PublicKey() @@ -35,6 +39,7 @@ func Add() { conf.MustAddPeer(peer) PrintPeerCfg(peer, conf) conf.MustSave() + ConfigureDevice(conf) } func PrintPeerCfg(peer PeerConfig, conf *DsnetConfig) { diff --git a/cmd/dsnet.go b/cmd/dsnet.go index cbc6b22..8a55af6 100644 --- a/cmd/dsnet.go +++ b/cmd/dsnet.go @@ -50,14 +50,19 @@ Usage: dsnet Available commands: init : Create %s containing default configuration + new keys without loading. Edit to taste. - add : Generate configuration for a new peer, adding to %s. Send with passworded ffsend. + add : Add a new peer + sync up : Create the interface, run pre/post up, sync - sync : Update wireguard configuration with %s, adding/removing peers after validating matching config + sync : Update wireguard configuration from %s after validating report : Generate a JSON status report to the location configured in %s. + remove : Remove a peer by hostname provided as argument + sync down : Destroy the interface, run pre/post down -To remove an interface or bring it down, use standard tools such as iproute2. -To modify or remove peers, edit %s and then run sync. -`, dsnet.CONFIG_FILE, dsnet.CONFIG_FILE, dsnet.CONFIG_FILE, dsnet.CONFIG_FILE, dsnet.CONFIG_FILE) +Examples: + + + dsnet add > dsnet.conf + + +`, dsnet.CONFIG_FILE, dsnet.CONFIG_FILE, dsnet.CONFIG_FILE) } diff --git a/remove.go b/remove.go index 1f3d1f3..fce8e0d 100644 --- a/remove.go +++ b/remove.go @@ -12,4 +12,5 @@ func Remove() { hostname := os.Args[2] conf.MustRemovePeer(hostname) conf.MustSave() + ConfigureDevice(conf) }