rpc

package
v0.0.0-...-215933a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2016 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
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 New

func New(token string, secure *tls.Config, resourceRoot string, enableBinaryDownload bool) (*grpc.Server, error)

New registers all servers and handlers for the RPC server

func NewExecutorClient

func NewExecutorClient(ctx context.Context, addr string, opts *ClientOpts) (pb.ExecutorClient, error)

NewExecutorClient returns a client for a server that implements Executor

Types

type ClientOpts

type ClientOpts struct {
	Token string
	SSL   *tls.Config
}

ClientOpts contains options for the Converge RPC client

func (*ClientOpts) Opts

func (c *ClientOpts) Opts() (out []grpc.DialOption)

Opts transforms the current config into options for grpc.DialContext

type ContextServer

type ContextServer struct {
	// contains filtered or unexported fields
}

ContextServer is a Server controlled by a context for stopping gracefully

func NewContextServer

func NewContextServer(ctx context.Context, handler http.Handler) *ContextServer

NewContextServer constructs and returns a server. Mux has the same meaning as in the standard HTTP package (that is, if nil it will use the globally registered handlers)

func NewRESTGateway

func NewRESTGateway(ctx context.Context, addr string, opts *ClientOpts) (*ContextServer, error)

NewRESTGateway constructs a REST gateway with the given options

func (*ContextServer) ListenAndServe

func (s *ContextServer) ListenAndServe(addr string) error

ListenAndServe does the same thing as the net/http equivalent, except using the context.

func (*ContextServer) ListenAndServeTLS

func (s *ContextServer) ListenAndServeTLS(addr, certFile, keyFile string) error

ListenAndServeTLS does the same thing as the net/http equivalent, except using the context.

type GrapherClient

type GrapherClient struct {
	// contains filtered or unexported fields
}

GrapherClient is a wrapper around a pb.GrapherClient

func NewGrapherClient

func NewGrapherClient(ctx context.Context, addr string, opts *ClientOpts) (*GrapherClient, error)

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 JWTAuth

type JWTAuth struct {
	// contains filtered or unexported fields
}

JWTAuth does authentication between client and server

func NewJWTAuth

func NewJWTAuth(token string) *JWTAuth

NewJWTAuth initializes a new JWTAuth from the token

func (*JWTAuth) GetRequestMetadata

func (j *JWTAuth) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

GetRequestMetadata gets the current request metadata

func (*JWTAuth) New

func (j *JWTAuth) New() (string, error)

New creates a signed token

func (*JWTAuth) Protect

func (j *JWTAuth) Protect(next http.Handler) http.Handler

Protect checks requests for a valid token

func (*JWTAuth) RequireTransportSecurity

func (j *JWTAuth) RequireTransportSecurity() bool

RequireTransportSecurity indicates whether JWT requires transport security (it does not)

func (*JWTAuth) Verify

func (j *JWTAuth) Verify(material string) error

Verify a generated token

Directories

Path Synopsis
pb
Package pb is a generated protocol buffer package.
Package pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL