Documentation ¶
Index ¶
- func CheckRPCAuth(ctx context.Context) error
- func DefaultServerOptions(srvOpts []grpc.ServerOption) []grpc.ServerOption
- func EnablePrometheus(s *grpc.Server, PORT string) http.Handler
- func GetgRPCHistograms() map[string]map[float64]uint64
- func GetgRPCMetrics() map[string]float64
- func KeepAliveDefault() grpc.ServerOption
- func PeerAddress(ctx context.Context) net.Addr
- func Serve(s *grpc.Server, port string)
- func SetupConnection(addr string, opts *ClientOpts) (*grpc.ClientConn, error)
- func StartgRPCWeb(s *grpc.Server, grpcwebport string)
- func TokenAuthCheck(ctx context.Context, srvToken string) (context.Context, error)
- func TokenAuthFunc(srvToken string) grpc_auth.AuthFunc
- func WithPerRPCToken(token string) grpc.DialOption
- type BasicAuthCreds
- type ClientOpts
- type TokenAuth
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRPCAuth ¶
CheckRPCAuth - used by servers to check RPC auth
func DefaultServerOptions ¶
func DefaultServerOptions(srvOpts []grpc.ServerOption) []grpc.ServerOption
ServerOptions return the chain of ServerOptions incl. middleware
func EnablePrometheus ¶
EnablePrometheus - sets up gRPC metrics collection and launch web collection endpoint
func GetgRPCHistograms ¶
GetgRPCHistograms grabs the data for all methods
func GetgRPCMetrics ¶
GetgRPCMetrics returns the grpc_prometheus metrics object
func KeepAliveDefault ¶
func KeepAliveDefault() grpc.ServerOption
func PeerAddress ¶
PeerAddress returns connecion peer address
func SetupConnection ¶
func SetupConnection(addr string, opts *ClientOpts) (*grpc.ClientConn, error)
SetupConnection handles base gRPC connection establishment
func StartgRPCWeb ¶
StartgRPCWeb encapsulates a gRPC server and serves gRPC on a new port
func TokenAuthCheck ¶
TokenAuthCheck ...
func TokenAuthFunc ¶
TokenAuthFunc - to be used with https://godoc.org/github.com/grpc-ecosystem/go-grpc-middleware/auth#UnaryServerInterceptor
func WithPerRPCToken ¶
func WithPerRPCToken(token string) grpc.DialOption
WithPerRPCToken - helper function
Types ¶
type BasicAuthCreds ¶
type BasicAuthCreds struct {
// contains filtered or unexported fields
}
BasicAuthCreds is an implementation of credentials.PerRPCCredentials that transforms the username and password into a base64 encoded value similar to HTTP Basic xxx
func (*BasicAuthCreds) GetRequestMetadata ¶
GetRequestMetadata sets the value for "authorization" key
func (*BasicAuthCreds) RequireTransportSecurity ¶
func (b *BasicAuthCreds) RequireTransportSecurity() bool
RequireTransportSecurity should be true as even though the credentials are base64, we want to have it encrypted over the wire.
type ClientOpts ¶
ClientOpts configure gRPC client connection
type TokenAuth ¶
type TokenAuth struct {
Token string
}
TokenAuth implement gRPC PerRPCCredentials interface
func (TokenAuth) GetRequestMetadata ¶
GetRequestMetadata implements PerRPCCredentials interface Return value is mapped to request headers.
func (TokenAuth) RequireTransportSecurity ¶
RequireTransportSecurity implements PerRPCCredentials interface