grpcclient

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 25 Imported by: 21

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 DialContext added in v0.12.0

func DialContext(ctx context.Context, target string, failFast FailFast, opts ...grpc.DialOption) (*grpc.ClientConn, error)

DialContext creates a grpc connection to the given target. Setup steps are covered by the context deadline, and, if WithBlock is specified in the dial options, connection establishment steps are covered by the context as well.

failFast is a non-optional parameter because callers are required to specify what that should be.

func RegisterFlags added in v0.15.0

func RegisterFlags(fs *pflag.FlagSet)

func RegisterGRPCDialOptions

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

RegisterGRPCDialOptions registers an implementation of AuthServer.

func ResetStaticAuth added in v0.20.0

func ResetStaticAuth()

ResetStaticAuth resets the static auth credentials.

func SecureDialOption

func SecureDialOption(cert, key, ca, crl, 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