Documentation ¶
Index ¶
- Constants
- func IsClosedNetworkConnErr(err error) bool
- func NewExecutorClient(ctx context.Context, addr string, security *Security) (pb.ExecutorClient, error)
- type GrapherClient
- type InfoClient
- type JWTAuth
- func (j *JWTAuth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
- func (j *JWTAuth) New() (string, error)
- func (j *JWTAuth) Protect(next http.Handler) http.Handler
- func (j *JWTAuth) RequireTransportSecurity() bool
- func (j *JWTAuth) StreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func (j *JWTAuth) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- func (j *JWTAuth) Verify(material string) error
- func (j *JWTAuth) VerifyContext(ctx context.Context) error
- type Security
- type Server
Constants ¶
const ( // JWTLifetime is the acceptable lifetime of an issued JWT token JWTLifetime = 30 * time.Second // JWTAlg is the signing algorithm used for signing and verification JWTAlg = "HS512" )
Variables ¶
This section is empty.
Functions ¶
func IsClosedNetworkConnErr ¶
IsClosedNetworkConnErr detects if an error is the use of a close network connection
func NewExecutorClient ¶
func NewExecutorClient(ctx context.Context, addr string, security *Security) (pb.ExecutorClient, error)
NewExecutorClient returns a client for a server that implements Executor
Types ¶
type GrapherClient ¶
type GrapherClient struct {
// contains filtered or unexported fields
}
GrapherClient is a wrapper around a pb.GrapherClient
func NewGrapherClient ¶
NewGrapherClient returns a client for a server that implements Executor
func (*GrapherClient) Graph ¶
func (gc *GrapherClient) Graph(ctx context.Context, loc *pb.LoadRequest, opts ...grpc.CallOption) (*graph.Graph, error)
Graph gets the graph from the remote side
type InfoClient ¶
type InfoClient struct {
// contains filtered or unexported fields
}
InfoClient is a wrapper around a pb.InfoClient
func NewInfoClient ¶
NewInfoClient returns a client for a server that implements Info
type JWTAuth ¶
type JWTAuth struct {
// contains filtered or unexported fields
}
JWTAuth does authentication between client and server
func NewJWTAuth ¶
NewJWTAuth initializes a new JWTAuth from the token
func (*JWTAuth) GetRequestMetadata ¶
GetRequestMetadata gets the current request metadata
func (*JWTAuth) RequireTransportSecurity ¶
RequireTransportSecurity indicates whether JWT requires transport security (it does not)
func (*JWTAuth) StreamInterceptor ¶
func (j *JWTAuth) StreamInterceptor(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
StreamInterceptor implements StreamServerInterceptor to use in a middleware capacity
func (*JWTAuth) UnaryInterceptor ¶
func (j *JWTAuth) UnaryInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
UnaryInterceptor implements UnaryServerInterceptor to use in a middleware capacity
type Security ¶
type Security struct { Token string UseSSL bool CAFile string CertFile string // server only KeyFile string // server only }
Security configuration for
func (*Security) Client ¶
func (s *Security) Client() (out []grpc.DialOption, err error)
Client returns a dial option for clients
func (*Security) Server ¶
func (s *Security) Server() (out []grpc.ServerOption)
Server return a server option with the certificate credentials