client

package
v1.1.0-beta.22 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginsRoot = root + ".plugins"
)

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

func NewClientConn

func NewClientConn(ctx context.Context, plugins ...Plugin) *grpc.ClientConn

NewClientConn returns a new grpc client connection.

func NewClientConnWithConfigPath

func NewClientConnWithConfigPath(ctx context.Context, path string) (*grpc.ClientConn, error)

NewClientConnWithConfigPath returns a new grpc client connection with options from config path.

func NewClientConnWithOptions

func NewClientConnWithOptions(ctx context.Context, options *Options, plugins ...Plugin) *grpc.ClientConn

NewClientConnWithOptions returns a new grpc client connection with options.

Types

type KeepAliveOptions

type KeepAliveOptions struct {
	Time                time.Duration
	Timeout             time.Duration
	PermitWithoutStream bool
}

type Options

type Options struct {
	TLS                   TLSOptions `config:"tls"`
	InitialWindowSize     int32
	InitialConnWindowSize int32
	Host                  string
	Block                 bool
	HostOverwrite         string
	Port                  int
	Keepalive             KeepAliveOptions
	ConnectParams         struct {
		Backoff struct {
			BaseDelay  time.Duration
			Multiplier float64
			Jitter     float64
			MaxDelay   time.Duration
		}
		MinConnectTimeout time.Duration
	}
}

Options grpc client options.

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns options from config file or environment vars.

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

NewOptionsWithPath unmarshals options based a given key path.

type Plugin

type Plugin func(ctx context.Context) ([]grpc.DialOption, []grpc.CallOption)

Plugin defines a function to process plugin.

type TLSOptions

type TLSOptions struct {
	Enabled            bool
	CertFile           string
	KeyFile            string
	CAFile             string `config:"caFile"`
	InsecureSkipVerify bool
}

Jump to

Keyboard shortcuts

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