grpcclient

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig rpc.Config = rpc.Config{
	MaxMessageSize:            rpc.DefaultMaxMessageSize,
	GRPCKeepAliveTime:         10 * time.Second,
	GRPCKeepAliveTimeout:      10 * time.Second,
	GRPCInitialConnWindowSize: 0,
	GRPCInitialWindowSize:     0,
}

DefaultConfig - grpc client dial default config

Functions

func AppendStaticAuth

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

AppendStaticAuth optionally appends static auth credentials if provided.

func RegisterGRPCDialOptions

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

RegisterGRPCDialOptions registers an implementation of AuthServer.

Types

type Conn

type Conn struct {
	*grpc.ClientConn
	// contains filtered or unexported fields
}

Conn - grpc conn

func NewConn

func NewConn(target string, cfg *rpc.Config) (*Conn, error)

NewConn - create new grpc client conn

func (*Conn) Close

func (c *Conn) Close() error

Close - release conn

func (*Conn) Dial

func (c *Conn) Dial(target string, opts ...grpc.DialOption) (*Conn, 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.

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