smegmesh/cmd/wg-mesh/main.go
Tim Beatham 01238aca59 Incorporated gin server.
Each node communicates in the mesh
2023-09-18 15:52:28 +01:00

33 lines
575 B
Go

package main
import (
"fmt"
"os"
"github.com/akamensky/argparse"
meshtypes "github.com/tim-beatham/wgmesh/pkg/wg-mesh"
)
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)
if err != nil {
fmt.Print(parser.Usage(err))
return
}
if newMeshCmd.Happened() {
mesh, err := meshtypes.NewWgMesh()
if err != nil {
fmt.Println("Could not generate new WgMesh")
} else {
fmt.Println(mesh.SharedKey.String())
}
}
}