grpc

package
v2.33.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DefaultContentChunkSize = 4 * 1024
)

Variables

View Source
var (
	// DefaultClientDialOptions are default settings for a connection to the dataplane
	DefaultClientDialOptions = []grpc.DialOption{
		grpc.WithStreamInterceptor(grpc_retry.StreamClientInterceptor()),
		grpc.WithUnaryInterceptor(grpc_retry.UnaryClientInterceptor()),
		grpc.WithKeepaliveParams(keepalive.ClientParameters{
			Time:                120 * time.Second,
			Timeout:             60 * time.Second,
			PermitWithoutStream: true,
		}),
	}

	DefaultServerDialOptions = []grpc.ServerOption{
		grpc.ChainUnaryInterceptor(grpc_validator.UnaryServerInterceptor()),
		grpc.StreamInterceptor(grpc_validator.StreamServerInterceptor()),
		grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
			MinTime:             60 * time.Second,
			PermitWithoutStream: true,
		}),
	}
)

Functions

func DataplaneConnectionDialOptions

func DataplaneConnectionDialOptions(Token string, meta *proto.Metadata) []grpc.DialOption

DataplaneConnectionDialOptions returns dialOptions for connecting to a dataplane instance

func GetCallOptions

func GetCallOptions() []grpc.CallOption

GetCallOptions -

func GetCommandChannel

func GetCommandChannel(client proto.CommanderClient) (proto.Commander_CommandChannelClient, error)

GetCommandChannel returns a channel that commands are sent over

func GetCommandClient

func GetCommandClient(conn *grpc.ClientConn) proto.CommanderClient

GetCommandClient returns a commanderClient with that grpc connection

func InitMeta

func InitMeta(clientID, cloudAccountID string)

func NewGrpcConnection

func NewGrpcConnection(target string, dialOptions []grpc.DialOption) (*grpc.ClientConn, error)

NewGrpcConnection -

func NewGrpcConnectionWithContext

func NewGrpcConnectionWithContext(ctx context.Context, server string, dialOptions []grpc.DialOption) (*grpc.ClientConn, error)

NewGrpcConnectionWithContext -

func NewMessageMeta

func NewMessageMeta(messageID string) *sdk.Metadata

func NewMeta

func NewMeta(clientID, messageID, cloudID string) *sdk.Metadata

NewMeta returns a new Metadata struct defined in the sdk/proto folder

func SecureDialOptions

func SecureDialOptions(tlsEnabled bool, certPath string, keyPath string, caPath string, serverName string, skipVerify bool) (grpc.DialOption, error)

SecureDialOptions returns dialOptions with tls support

Types

This section is empty.

Jump to

Keyboard shortcuts

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