rpcclient

package
v0.27.272 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides and manages v1 client session.

func New

func New(cfg *Config, ignoreAccessTokenError bool) (*Client, error)

New creates a new client from a given configuration.

func NewFromURL

func NewFromURL(url string, ignoreAccessTokenError bool) (*Client, error)

NewFromURL creates a new client from a URL.

func (*Client) Close

func (c *Client) Close() error

Close shuts down the client's connections.

func (*Client) Conn

func (c *Client) Conn() *grpc.ClientConn

Conn returns the current in-use connection

func (*Client) Opts

func (c *Client) Opts() []grpc.CallOption

Opts returns the current Call options

type Config

type Config struct {
	// Endpoint of the server
	Endpoint string

	// DialTimeout is the timeout for failing to establish a connection.
	DialTimeout time.Duration

	// DialKeepAliveTime is the time after which client pings the server to see if
	// transport is alive.
	DialKeepAliveTime time.Duration

	// DialKeepAliveTimeout is the time that the client waits for a response for the
	// keep-alive probe. If the response is not received in this time, the connection is closed.
	DialKeepAliveTimeout time.Duration

	// TLS holds the client secure credentials, if any.
	TLS *tls.Config

	// DialOptions is a list of dial options for the grpc client (e.g., for interceptors).
	// For example, pass "grpc.WithBlock()" to block until the underlying connection is up.
	// Without this, Dial returns immediately and connecting the server happens in background.
	DialOptions []grpc.DialOption

	// Context is the default client context; it can be used to cancel grpc dial out and
	// other operations that do not have an explicit context.
	Context context.Context

	StorageFolder    string
	EnvAuthTokenName string
	UserAgent        string

	CallerIdentity credentials.CallerIdentity
}

Config for the client

func (*Config) LoadAuthToken

func (c *Config) LoadAuthToken() (*retriable.AuthToken, string, error)

LoadAuthToken returns AuthToken

func (*Config) Storage

func (c *Config) Storage() *retriable.Storage

Storage returns the current storage

Jump to

Keyboard shortcuts

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