Documentation ¶
Index ¶
- Variables
- func FakeAuthStreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func FakeAuthUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func GetAuthenticator(name string) (func([]byte) (Authenticator, error), error)
- func RegisterAuthPlugin(name string, authPlugin func([]byte) (Authenticator, error)) error
- type Authenticator
- type InterceptorBuilder
- type Server
- type StaticAuthConfigEntry
- type StaticAuthPlugin
- type WrappedServerStream
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig rpc.Config = rpc.Config{ MaxMessageSize: rpc.DefaultMaxMessageSize, GRPCPort: 8264, GRPCInitialConnWindowSize: 0, GRPCInitialWindowSize: 0, EnableTracing: false, EnableGRPCPrometheus: false, GRPCKeepAliveEnforcementPolicyPermitWithoutStream: false, GRPCCert: "", GRPCKey: "", GRPCCA: "", GRPCAuth: "", GRPCMaxConnectionAge: time.Duration(math.MaxInt64), GRPCMaxConnectionAgeGrace: time.Duration(math.MaxInt64), GRPCKeepAliveEnforcementPolicyMinTime: 5 * time.Minute, }
DefaultConfig - rpc default config
Functions ¶
func FakeAuthStreamInterceptor ¶
func FakeAuthStreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
FakeAuthStreamInterceptor fake interceptor to test plugin
func FakeAuthUnaryInterceptor ¶
func FakeAuthUnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
FakeAuthUnaryInterceptor fake interceptor to test plugin
func GetAuthenticator ¶
func GetAuthenticator(name string) (func([]byte) (Authenticator, error), error)
GetAuthenticator returns an AuthPlugin by name, or log.Fatalf.
func RegisterAuthPlugin ¶
func RegisterAuthPlugin(name string, authPlugin func([]byte) (Authenticator, error)) error
RegisterAuthPlugin registers an implementation of AuthServer.
Types ¶
type Authenticator ¶
type Authenticator interface {
Authenticate(ctx context.Context, fullMethod string) (context.Context, error)
}
Authenticator provides an interface to implement auth in Vitess in grpc server
type InterceptorBuilder ¶
type InterceptorBuilder struct { StreamServerInterceptor grpc.StreamServerInterceptor UnaryStreamInterceptor grpc.UnaryServerInterceptor }
InterceptorBuilder chains together multiple ServerInterceptors
func (*InterceptorBuilder) Add ¶
func (collector *InterceptorBuilder) Add(s grpc.StreamServerInterceptor, u grpc.UnaryServerInterceptor)
Add is used to add two ServerInterceptors.
func (*InterceptorBuilder) NonEmpty ¶
func (collector *InterceptorBuilder) NonEmpty() bool
NonEmpty check if ServerInterceptor is empty.
type Server ¶
Server - rpc server
func NewRPCServer ¶
NewRPCServer create the gRPC server we will be using. It has to be called after flags are parsed, but before services register themselves.
type StaticAuthConfigEntry ¶
StaticAuthConfigEntry is the container for server side credentials. Current implementation matches the the one from the client but this will change in the future as we hooked this pluging into ACL features.
type StaticAuthPlugin ¶
type StaticAuthPlugin struct {
// contains filtered or unexported fields
}
StaticAuthPlugin implements static username/password authentication for grpc. It contains an array of username/passwords that will be authorized to connect to the grpc server.
func (*StaticAuthPlugin) Authenticate ¶
func (sa *StaticAuthPlugin) Authenticate(ctx context.Context, fullMethod string) (context.Context, error)
Authenticate implements AuthPlugin interface. This method will be used inside a middleware in grpc_server to authenticate incoming requests.
type WrappedServerStream ¶
type WrappedServerStream struct { grpc.ServerStream WrappedContext context.Context }
WrappedServerStream is based on the service stream wrapper from: https://github.com/grpc-ecosystem/go-grpc-middleware
func WrapServerStream ¶
func WrapServerStream(stream grpc.ServerStream) *WrappedServerStream
WrapServerStream returns a ServerStream that has the ability to overwrite context.
func (*WrappedServerStream) Context ¶
func (w *WrappedServerStream) Context() context.Context
Context returns the wrapper's WrappedContext, overwriting the nested grpc.ServerStream.Context()