1
0
forked from extern/smegmesh
smegmesh/cmd/wg-mesh/main.go

33 lines
575 B
Go
Raw Normal View History

2023-09-18 13:59:28 +02:00
package main
import (
"fmt"
"os"
"github.com/akamensky/argparse"
meshtypes "github.com/tim-beatham/wgmesh/pkg/wg-mesh"
2023-09-18 13:59:28 +02:00
)
func main() {
parser := argparse.NewParser("wg-mesh",
"wg-mesh Manipulate WireGuard meshes")
newMeshCmd := parser.NewCommand("new-mesh", "Create a new mesh")
err := parser.Parse(os.Args)
2023-09-18 13:59:28 +02:00
if err != nil {
fmt.Print(parser.Usage(err))
return
}
2023-09-18 13:59:28 +02:00
if newMeshCmd.Happened() {
mesh, err := meshtypes.NewWgMesh()
2023-09-18 13:59:28 +02:00
if err != nil {
fmt.Println("Could not generate new WgMesh")
} else {
fmt.Println(mesh.SharedKey.String())
}
}
}