mirror of
https://github.com/tim-beatham/smegmesh.git
synced 2024-12-13 01:50:53 +01:00
01238aca59
Each node communicates in the mesh
33 lines
575 B
Go
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())
|
|
}
|
|
}
|
|
}
|