grpcclient

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package grpcclient contains utility methods for gRPC client implementations to use. It also supports plug-in authentication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendStaticAuth

func AppendStaticAuth(opts []grpc.DialOption) ([]grpc.DialOption, error)

AppendStaticAuth optionally appends static auth credentials if provided.

func Dial

func Dial(target string, failFast FailFast, opts ...grpc.DialOption) (*grpc.ClientConn, error)

Dial creates a grpc connection to the given target. failFast is a non-optional parameter because callers are required to specify what that should be.

func RegisterGRPCDialOptions

func RegisterGRPCDialOptions(grpcDialOptionsFunc func(opts []grpc.DialOption) ([]grpc.DialOption, error))

RegisterGRPCDialOptions registers an implementation of AuthServer.

func SecureDialOption

func SecureDialOption(cert, key, ca, name string) (grpc.DialOption, error)

SecureDialOption returns the gRPC dial option to use for the given client connection. It is either using TLS, or Insecure if nothing is set.

Types

type FailFast

type FailFast bool

FailFast is a self-documenting type for the grpc.FailFast.

type SnappyCompressor

type SnappyCompressor struct{}

SnappyCompressor is a gRPC compressor using the Snappy algorithm.

func (SnappyCompressor) Compress

func (s SnappyCompressor) Compress(w io.Writer) (io.WriteCloser, error)

Compress wraps with a SnappyReader

func (SnappyCompressor) Decompress

func (s SnappyCompressor) Decompress(r io.Reader) (io.Reader, error)

Decompress wraps with a SnappyReader

func (SnappyCompressor) Name

func (s SnappyCompressor) Name() string

Name is "snappy"

type StaticAuthClientCreds

type StaticAuthClientCreds struct {
	Username string
	Password string
}

StaticAuthClientCreds holder for client credentials

func (*StaticAuthClientCreds) GetRequestMetadata

func (c *StaticAuthClientCreds) GetRequestMetadata(context.Context, ...string) (map[string]string, error)

GetRequestMetadata gets the request metadata as a map from StaticAuthClientCreds

func (*StaticAuthClientCreds) RequireTransportSecurity

func (c *StaticAuthClientCreds) RequireTransportSecurity() bool

RequireTransportSecurity indicates whether the credentials requires transport security. Given that people can use this with or without TLS, at the moment we are not enforcing transport security

Jump to

Keyboard shortcuts

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