dsnet/cmd/dsnet.go

45 lines
824 B
Go
Raw Normal View History

2020-02-09 21:56:51 +01:00
package main
import (
"os"
2020-02-20 21:02:56 +01:00
"flag"
2020-02-27 23:52:57 +01:00
"fmt"
2020-02-09 21:56:51 +01:00
"github.com/naggie/dsnet"
)
func main() {
2020-02-20 21:02:56 +01:00
addCmd := flag.NewFlagSet("add", flag.ExitOnError)
2020-02-09 21:56:51 +01:00
2020-02-20 21:02:56 +01:00
switch os.Args[1] {
case "init":
2020-02-27 23:52:57 +01:00
dsnet.Init()
2020-02-20 21:02:56 +01:00
case "up":
case "add":
case "report":
case "down":
default:
help();
}
2020-02-09 21:56:51 +01:00
}
2020-02-27 23:52:57 +01:00
func help() {
fmt.Printf(`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. (Send with passworded ffsend)
sync : Synchronise wireguard configuration with %s, creating and activating interface if necessary
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.
`, dstask.CONFIG_FILE, dstask.CONFIG_FILE, dstask.CONFIG_FILE)
}