Documentation ¶
Overview ¶
Package grpcclient contains utility methods for gRPC client implementations to use. It also supports plug-in authentication.
Index ¶
- func AppendStaticAuth(opts []grpc.DialOption) ([]grpc.DialOption, error)
- func DialContext(ctx context.Context, target string, failFast FailFast, opts ...grpc.DialOption) (*grpc.ClientConn, error)
- func RegisterFlags(fs *pflag.FlagSet)
- func RegisterGRPCDialOptions(grpcDialOptionsFunc func(opts []grpc.DialOption) ([]grpc.DialOption, error))
- func ResetStaticAuth()
- func SecureDialOption(cert, key, ca, crl, name string) (grpc.DialOption, error)
- type FailFast
- type SnappyCompressor
- type StaticAuthClientCreds
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 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 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 ¶
Decompress wraps with a SnappyReader
type StaticAuthClientCreds ¶
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.