mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-25 17:43:38 +01:00
c3bc85e22d
rename the go module to netbirdio/netbird as part of our rebranding.
46 lines
967 B
Go
46 lines
967 B
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/kardianos/service"
|
|
log "github.com/sirupsen/logrus"
|
|
"github.com/spf13/cobra"
|
|
"google.golang.org/grpc"
|
|
|
|
"github.com/netbirdio/netbird/client/internal"
|
|
)
|
|
|
|
type program struct {
|
|
ctx context.Context
|
|
cancel context.CancelFunc
|
|
serv *grpc.Server
|
|
}
|
|
|
|
func newProgram(ctx context.Context, cancel context.CancelFunc) *program {
|
|
ctx = internal.CtxInitState(ctx)
|
|
return &program{ctx: ctx, cancel: cancel}
|
|
}
|
|
|
|
func newSVCConfig() *service.Config {
|
|
return &service.Config{
|
|
Name: "wiretrustee",
|
|
DisplayName: "Wiretrustee",
|
|
Description: "A WireGuard-based mesh network that connects your devices into a single private network.",
|
|
}
|
|
}
|
|
|
|
func newSVC(prg *program, conf *service.Config) (service.Service, error) {
|
|
s, err := service.New(prg, conf)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
return nil, err
|
|
}
|
|
return s, nil
|
|
}
|
|
|
|
var serviceCmd = &cobra.Command{
|
|
Use: "service",
|
|
Short: "manages wiretrustee service",
|
|
}
|