feat:#36 added protobuf communication for modules

This commit is contained in:
Elmar Kresse
2024-06-17 00:59:33 +02:00
parent 8548a537ec
commit fad85f2884
18 changed files with 1286 additions and 59 deletions

View File

@@ -0,0 +1,21 @@
package grpc
import (
"google.golang.org/grpc"
"log/slog"
)
func ConnectGRPCServer(host string) *grpc.ClientConn {
conn, err := grpc.Dial(host+":50051", grpc.WithInsecure(), grpc.WithBlock())
if err != nil {
slog.Error("could not connect to grpc server", "error", err)
}
return conn
}
func CloseGRPCServer(conn *grpc.ClientConn) {
err := conn.Close()
if err != nil {
slog.Error("could not close connection", "error", err)
}
}