adding grpc server.

This commit is contained in:
greg stone
2023-02-22 14:12:47 +00:00
parent 0531f7c726
commit e8dbf93a54
2 changed files with 12 additions and 5 deletions

View File

@@ -68,10 +68,6 @@ var seedCmd = &cobra.Command{
log.I.Ln("running seed")
//
// Set the context
//
var ctx context.Context
var cancel context.CancelFunc
@@ -92,7 +88,8 @@ var seedCmd = &cobra.Command{
}
// We need to enable specific gRPC services here
// rpc.Register()
//srv := rpc.Server()
//helloworld.RegisterGreeterServer(srv, helloworld)
log.I.Ln("starting rpc server")

View File

@@ -9,6 +9,7 @@ import (
"golang.zx2c4.com/wireguard/device"
"golang.zx2c4.com/wireguard/tun"
"golang.zx2c4.com/wireguard/tun/netstack"
"google.golang.org/grpc"
"net"
"net/netip"
"os"
@@ -56,8 +57,17 @@ var (
tunnel tun.Device
unixSock net.Listener
tcpSock net.Listener
server *grpc.Server
)
func init() {
server = grpc.NewServer()
}
func Server() *grpc.Server {
return server
}
func Start(ctx context.Context) {
var err error