Documentation ¶
Overview ¶
Package avaiation is a collection of tools to support grpc middleware
Index ¶
- func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor
- func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
- func Dial(ctx context.Context, opts DialOptions) (*grpc.ClientConn, error)
- func GetClientTLSConfig(ca, crt, key []byte) (*tls.Config, error)
- func GetClientTLSConfigFromFiles(caFile, crtFile, keyFile string) (*tls.Config, error)
- func GetRequestID(ctx context.Context) int
- func GetRequestStartAt(ctx context.Context) time.Time
- func GetUser(ctx context.Context) gimlet.User
- func MakeAuthenticationRequiredStreamInterceptor(um gimlet.UserManager, conf gimlet.UserMiddlewareConfiguration) grpc.StreamServerInterceptor
- func MakeAuthenticationRequiredUnaryInterceptor(um gimlet.UserManager, conf gimlet.UserMiddlewareConfiguration) grpc.UnaryServerInterceptor
- func MakeCertificateUserValidationStreamInterceptor(um gimlet.UserManager) grpc.StreamServerInterceptor
- func MakeCertificateUserValidationUnaryInterceptor(um gimlet.UserManager) grpc.UnaryServerInterceptor
- func MakeGripStreamInterceptor(logger grip.Journaler) grpc.StreamServerInterceptor
- func MakeGripUnaryInterceptor(logger grip.Journaler) grpc.UnaryServerInterceptor
- func MakeRetryStreamClientInterceptor(maxRetries int) grpc.StreamClientInterceptor
- func MakeRetryUnaryClientInterceptor(maxRetries int) grpc.UnaryClientInterceptor
- func SetRequestID(ctx context.Context, id int) context.Context
- func SetRequestStartAt(ctx context.Context, startAt time.Time) context.Context
- func SetRequestUser(ctx context.Context, u gimlet.User) context.Context
- type DialOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChainStreamServer ¶
func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor
ChainStreamServer creates a single interceptor out of a chain of many interceptors.
Execution is done in left-to-right order, including passing of context. For example ChainUnaryServer(one, two, three) will execute one before two before three. If you want to pass context between interceptors, use WrapServerStream.
Implementation from https://github.com/grpc-ecosystem/go-grpc-middleware/blob/master/chain.go
func ChainUnaryServer ¶
func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
ChainUnaryServer creates a single interceptor out of a chain of many interceptors.
Execution is done in left-to-right order, including passing of context. For example ChainUnaryServer(one, two, three) will execute one before two before three, and three will see context changes of one and two.
Implementation from https://github.com/grpc-ecosystem/go-grpc-middleware/blob/master/chain.go
func Dial ¶
func Dial(ctx context.Context, opts DialOptions) (*grpc.ClientConn, error)
Dial creates a client connection to a RPC service via gRPC.
func GetClientTLSConfig ¶
GetClientTLSConfig creates a creates a client-side TLS configuration based on the given ca, cert, and key.
func GetClientTLSConfigFromFiles ¶
GetClientTLSConfigFromFiles creates a creates a client-side TLS configuration based on the given ca, cert, and key files.
func GetRequestID ¶
GetRequestID returns the unique (monotonically increaseing) ID of the request since startup
func MakeAuthenticationRequiredStreamInterceptor ¶
func MakeAuthenticationRequiredStreamInterceptor(um gimlet.UserManager, conf gimlet.UserMiddlewareConfiguration) grpc.StreamServerInterceptor
func MakeAuthenticationRequiredUnaryInterceptor ¶
func MakeAuthenticationRequiredUnaryInterceptor(um gimlet.UserManager, conf gimlet.UserMiddlewareConfiguration) grpc.UnaryServerInterceptor
func MakeCertificateUserValidationStreamInterceptor ¶
func MakeCertificateUserValidationStreamInterceptor(um gimlet.UserManager) grpc.StreamServerInterceptor
Return a gRPC UnaryStreamInterceptor which checks the certifcate user's validity against the given user manager.
func MakeCertificateUserValidationUnaryInterceptor ¶
func MakeCertificateUserValidationUnaryInterceptor(um gimlet.UserManager) grpc.UnaryServerInterceptor
Return a gRPC UnaryServerInterceptor which checks the certifcate user's validity against the given user manager.
func MakeGripStreamInterceptor ¶
func MakeGripStreamInterceptor(logger grip.Journaler) grpc.StreamServerInterceptor
func MakeGripUnaryInterceptor ¶
func MakeGripUnaryInterceptor(logger grip.Journaler) grpc.UnaryServerInterceptor
func MakeRetryStreamClientInterceptor ¶
func MakeRetryStreamClientInterceptor(maxRetries int) grpc.StreamClientInterceptor
func MakeRetryUnaryClientInterceptor ¶
func MakeRetryUnaryClientInterceptor(maxRetries int) grpc.UnaryClientInterceptor
func SetRequestID ¶
SetRequesID attaches a request id to a context.
func SetRequestStartAt ¶
Types ¶
type DialOptions ¶
type DialOptions struct { // Address is the RPC address to connect to. Address string // Retries specifies the number of times the client connection retries // an operation before failing. Retries int // TLSConf is the config for TLS authentication. If TLSConf is // specified, CAFile, CrtFile, and KeyFile are ignored. If neither // TLSFile nor the certificate files are specified, the connection is // created without TLS. (Optional) TLSConf *tls.Config // CAFile is the name of the file with the CA certificate for TLS. If // specified, CrtFile and KeyFile must also be specified. (Optional) CAFile string // CrtFile is the name of the file with the user certificate for TLS. // If specified, CAFile and KeyFile must also be specified. (Optional) CrtFile string // KeyFile is the name of the file with the key certificate for TLS. If // specified, CAFile and CrtFile must also be specified. (Optional) KeyFile string }
DialOptions describes the options for creating a client connection to a RPC service via gRPC.