Documentation
¶
Index ¶
- Variables
- func EmbedContext(ctx netcontext.Context) (netcontext.Context, error)
- func ExtractContext(context netcontext.Context, app app.Ctx) (journey.Ctx, error)
- func MustDialOption(opt grpc.DialOption, err error) grpc.DialOption
- func WithMutualTLS(serverName, certFile, keyFile, caFile string) (grpc.DialOption, error)
- func WithTLS(certFile, serverNameOverride string) (grpc.DialOption, error)
- type Client
- type Server
- func (s *Server) ActivateMutualTLS(certFile, keyFile, caFile string)
- func (s *Server) ActivateTLS(certFile, keyFile string)
- func (s *Server) AppendUnaryMiddleware(m UnaryServerMiddleware)
- func (s *Server) Drain()
- func (s *Server) Handle(f func(*grpc.Server))
- func (s *Server) RegisterService(sd *grpc.ServiceDesc, ss interface{})
- func (s *Server) Serve(addr string, ctx app.Ctx) error
- func (s *Server) SetOptions(opts ...grpc.ServerOption)
- type UnaryClientMiddleware
- type UnaryHandler
- type UnaryServerMiddleware
Constants ¶
This section is empty.
Variables ¶
var ErrMissingJourney = errors.New("missing journey")
ErrMissingJourney occurs when there is an attempt to extract a journey from an incomming context that does not have it
Functions ¶
func EmbedContext ¶
func EmbedContext(ctx netcontext.Context) (netcontext.Context, error)
EmbedContext embeds a journey into a generic context
func ExtractContext ¶
ExtractContext extracts journey from a generic context
func MustDialOption ¶
func MustDialOption(opt grpc.DialOption, err error) grpc.DialOption
MustDialOption panics if it receives an error
func WithMutualTLS ¶
func WithMutualTLS( serverName, certFile, keyFile, caFile string, ) (grpc.DialOption, error)
WithMutualTLS returns a dial option for the GRPC client that activates a mutual TLS authentication between the server and the client.
Types ¶
type Client ¶
type Client struct { // HTTP is the standard net/http client GRPC *grpc.ClientConn // PropagateContext tells whether the journey should be propagated upstream // // This should be activated when the upstream endpoint is a LEGO service // or another LEGO-compatible service. The context can potentially leak // sensitive information, so do not activate it for services that you // don't trust. PropagateContext bool // contains filtered or unexported fields }
Client is a wrapper for the grpc client.
func (*Client) AppendUnaryMiddleware ¶
func (c *Client) AppendUnaryMiddleware(m UnaryClientMiddleware)
type Server ¶
A Server defines parameters for running a lego compatible GRPC server
func (*Server) ActivateMutualTLS ¶
ActivateMutualTLS activates TLS on this handler. That means only incoming TLS connections are allowed and clients must authenticate themselves to the server.
If the certificate is signed by a certificate authority, the certFile should be the concatenation of the server's certificate, any intermediates, and the CA's certificate.
func (*Server) ActivateTLS ¶
ActivateTLS activates TLS on this handler. That means only incoming TLS connections are allowed.
If the certificate is signed by a certificate authority, the certFile should be the concatenation of the server's certificate, any intermediates, and the CA's certificate.
Clients are not authenticated.
func (*Server) AppendUnaryMiddleware ¶
func (s *Server) AppendUnaryMiddleware(m UnaryServerMiddleware)
AppendUnaryMiddleware appends an unary middleware to the call chain
func (*Server) Handle ¶
Handle just injects the GRPC server to register a service. The function is called back only when Serve is called. This must be called before invoking Serve.
func (*Server) RegisterService ¶
func (s *Server) RegisterService(sd *grpc.ServiceDesc, ss interface{})
RegisterService register a service and its implementation to the gRPC server. Called from the IDL generated code.
The function is called back only when Serve is called. This must be called before invoking Serve.
func (*Server) SetOptions ¶
func (s *Server) SetOptions(opts ...grpc.ServerOption)
SetOptions changes the handler options
type UnaryClientMiddleware ¶
type UnaryClientMiddleware func(grpc.UnaryInvoker) grpc.UnaryInvoker
type UnaryHandler ¶
type UnaryServerMiddleware ¶
type UnaryServerMiddleware func(next UnaryHandler) UnaryHandler