grpc

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: Apache-2.0 Imports: 18 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAgentOptions

func NewAgentOptions(grpcOptions *GRPCOptions, clusterName, agentID string) *options.CloudEventsAgentOptions

func NewSourceOptions

func NewSourceOptions(gRPCOptions *GRPCOptions, sourceID string) *options.CloudEventsSourceOptions

Types

type GRPCConfig

type GRPCConfig struct {
	// URL is the address of the gRPC server (host:port).
	URL string `json:"url" yaml:"url"`
	// CAFile is the file path to a cert file for the gRPC server certificate authority.
	CAFile string `json:"caFile,omitempty" yaml:"caFile,omitempty"`
	// ClientCertFile is the file path to a client cert file for TLS.
	ClientCertFile string `json:"clientCertFile,omitempty" yaml:"clientCertFile,omitempty"`
	// ClientKeyFile is the file path to a client key file for TLS.
	ClientKeyFile string `json:"clientKeyFile,omitempty" yaml:"clientKeyFile,omitempty"`
	// TokenFile is the file path to a token file for authentication.
	TokenFile string `json:"tokenFile,omitempty" yaml:"tokenFile,omitempty"`
	// keepalive options
	KeepAliveConfig KeepAliveConfig `json:"keepAliveConfig,omitempty" yaml:"keepAliveConfig,omitempty"`
}

GRPCConfig holds the information needed to build connect to gRPC server as a given user.

type GRPCDialer added in v0.16.0

type GRPCDialer struct {
	URL              string
	KeepAliveOptions KeepAliveOptions
	TLSConfig        *tls.Config
	TokenFile        string
	// contains filtered or unexported fields
}

GRPCDialer is a gRPC dialer that connects to a gRPC server with the given URL, TLS configuration and keepalive options.

func (*GRPCDialer) Close added in v0.16.0

func (d *GRPCDialer) Close() error

Close closes the gRPC client connection.

func (*GRPCDialer) Dial added in v0.16.0

func (d *GRPCDialer) Dial() (*grpc.ClientConn, error)

Dial connects to the gRPC server and returns a gRPC client connection.

type GRPCOptions

type GRPCOptions struct {
	Dialer *GRPCDialer
}

GRPCOptions holds the options that are used to build gRPC client.

func BuildGRPCOptionsFromFlags

func BuildGRPCOptionsFromFlags(configPath string) (*GRPCOptions, error)

BuildGRPCOptionsFromFlags builds configs from a config filepath.

func NewGRPCOptions

func NewGRPCOptions() *GRPCOptions

func (*GRPCOptions) GetCloudEventsProtocol added in v0.14.0

func (o *GRPCOptions) GetCloudEventsProtocol(ctx context.Context, errorHandler func(error), clientOpts ...protocol.Option) (options.CloudEventsProtocol, error)

type KeepAliveConfig added in v0.16.0

type KeepAliveConfig struct {
	// Enable specifies whether the keepalive option is enabled.
	// When disabled, other keepalive configurations are ignored. Default is false.
	Enable bool `json:"enable,omitempty" yaml:"enable,omitempty"`
	// Time sets the duration after which the client pings the server if no activity is seen.
	// A minimum value of 10s is enforced if set below that. Default is 30s.
	Time *time.Duration `json:"time,omitempty" yaml:"time,omitempty"`

	// Timeout sets the duration the client waits for a response after a keepalive ping.
	// If no response is received, the connection is closed. Default is 10s.
	Timeout *time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`

	// PermitWithoutStream determines if keepalive pings are sent when there are no active RPCs.
	// If false, pings are not sent and Time and Timeout are ignored. Default is false.
	PermitWithoutStream bool `json:"permitWithoutStream,omitempty" yaml:"permitWithoutStream,omitempty"`
}

KeepAliveConfig holds the keepalive options for the gRPC client.

type KeepAliveOptions added in v0.16.0

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

KeepAliveOptions holds the keepalive options for the gRPC client.

Directories

Path Synopsis
protobuf
v1

Jump to

Keyboard shortcuts

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