sync on add/remove
This commit is contained in:
parent
0380753104
commit
586292a25a
5
add.go
5
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) {
|
||||
|
15
cmd/dsnet.go
15
cmd/dsnet.go
@ -50,14 +50,19 @@ Usage: dsnet <cmd>
|
||||
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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user