client

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: MIT Imports: 14 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 a given key path into options and returns it.

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