smegmesh/cmd/wgmeshd/main.go

35 lines
662 B
Go
Raw Normal View History

package main
import (
2023-09-19 14:45:49 +02:00
"fmt"
"net"
2023-09-19 14:45:49 +02:00
ctrlserver "github.com/tim-beatham/wgmesh/pkg/ctrlserver"
2023-09-18 18:00:43 +02:00
"github.com/tim-beatham/wgmesh/pkg/ctrlserver/ipc"
"github.com/tim-beatham/wgmesh/pkg/ctrlserver/rpc"
2023-09-19 14:45:49 +02:00
wg "github.com/tim-beatham/wgmesh/pkg/wg"
)
func main() {
2023-09-19 14:45:49 +02:00
wgClient, err := wg.CreateClient("wgmesh")
if err != nil {
fmt.Println(err)
return
}
2023-09-20 00:50:44 +02:00
ctrlServer := ctrlserver.NewCtrlServer(wgClient, "wgmesh")
fmt.Println("Running IPC Handler")
go ipc.RunIpcHandler(ctrlServer)
2023-09-20 00:50:44 +02:00
grpc := rpc.NewRpcServer(ctrlServer)
lis, err := net.Listen("tcp", ":8080")
if err := grpc.Serve(lis); err != nil {
fmt.Print(err.Error())
}
2023-09-20 15:34:34 +02:00
defer wgClient.Close()
}