2022-03-27 10:59:30 +00:00
|
|
|
package dataplane
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/hashicorp/go-hclog"
|
|
|
|
"google.golang.org/grpc"
|
2022-04-05 21:10:06 +00:00
|
|
|
|
|
|
|
"github.com/hashicorp/consul/acl"
|
|
|
|
"github.com/hashicorp/consul/proto-public/pbdataplane"
|
2022-03-27 10:59:30 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Server struct {
|
|
|
|
Config
|
|
|
|
}
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
Logger hclog.Logger
|
|
|
|
ACLResolver ACLResolver
|
|
|
|
}
|
|
|
|
|
|
|
|
//go:generate mockery -name ACLResolver -inpkg
|
|
|
|
type ACLResolver interface {
|
2022-04-05 21:10:06 +00:00
|
|
|
ResolveTokenAndDefaultMeta(string, *acl.EnterpriseMeta, *acl.AuthorizerContext) (acl.Authorizer, error)
|
2022-03-27 10:59:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewServer(cfg Config) *Server {
|
|
|
|
return &Server{cfg}
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ pbdataplane.DataplaneServiceServer = (*Server)(nil)
|
|
|
|
|
|
|
|
func (s *Server) Register(grpcServer *grpc.Server) {
|
|
|
|
pbdataplane.RegisterDataplaneServiceServer(grpcServer, s)
|
|
|
|
}
|