grpcutil

package
Version: v2.388.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: Apache-2.0, MIT Imports: 16 Imported by: 0

Documentation

Overview

Package grpcutil contains gRPC lazy codecs, messages and a buf-based listener.

Index

Constants

View Source
const (
	P_GRPC           = BertyCustomPrefix + 0x0002 //nolint:revive
	P_GRPC_WEB       = BertyCustomPrefix + 0x0004 //nolint:revive
	P_GRPC_WEBSOCKET = BertyCustomPrefix + 0x0008 //nolint:revive
	P_GRPC_GATEWAY   = BertyCustomPrefix + 0x0016 //nolint:revive
)
View Source
const BertyCustomPrefix = 0xbe00

BertyCustomPrefix is a multiformat custom prefix

Variables

This section is empty.

Functions

func NewUnsecureSimpleAuthAccess added in v2.154.0

func NewUnsecureSimpleAuthAccess(scheme, token string) credentials.PerRPCCredentials

NewUnsecureSimpleAuthAccess constructs the PerRPCCredentials using a given token.

Types

type BufListener added in v2.112.0

type BufListener struct {
	*bufconn.Listener
	// contains filtered or unexported fields
}

func NewBufListener added in v2.112.0

func NewBufListener(ctx context.Context, sz int) *BufListener

func (*BufListener) NewClientConn added in v2.112.0

func (bl *BufListener) NewClientConn(opts ...grpc.DialOption) (*grpc.ClientConn, error)

type LazyClient added in v2.202.0

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

func NewLazyClient added in v2.202.0

func NewLazyClient(cc *grpc.ClientConn) *LazyClient

func (*LazyClient) InvokeStream added in v2.202.0

func (lc *LazyClient) InvokeStream(ctx context.Context, desc *LazyMethodDesc, in *LazyMessage, copts ...grpc.CallOption) (*LazyStream, error)

func (*LazyClient) InvokeUnary added in v2.202.0

func (lc *LazyClient) InvokeUnary(ctx context.Context, desc *LazyMethodDesc, in *LazyMessage, copts ...grpc.CallOption) (out *LazyMessage, err error)

type LazyCodec

type LazyCodec struct{}

LazyCodec is basically a no-op grpc.Codec use to pass LazyMessage through grpc

func NewLazyCodec

func NewLazyCodec() *LazyCodec

func (*LazyCodec) Marshal

func (lc *LazyCodec) Marshal(value interface{}) ([]byte, error)

func (*LazyCodec) Name

func (lc *LazyCodec) Name() string

func (*LazyCodec) String

func (lc *LazyCodec) String() string

func (*LazyCodec) Unmarshal

func (*LazyCodec) Unmarshal(buf []byte, value interface{}) error

type LazyMessage

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

LazyMessage is basically a no-op `proto.Message` used to pass serialized message through grpc

func NewLazyMessage

func NewLazyMessage() *LazyMessage

func (*LazyMessage) Base64

func (m *LazyMessage) Base64() string

func (*LazyMessage) Bytes

func (m *LazyMessage) Bytes() []byte

func (*LazyMessage) FromBase64

func (m *LazyMessage) FromBase64(b64 string) (lm *LazyMessage, err error)

func (*LazyMessage) FromBytes

func (m *LazyMessage) FromBytes(buf []byte) *LazyMessage

func (*LazyMessage) ProtoMessage

func (m *LazyMessage) ProtoMessage()

func (*LazyMessage) Reset

func (m *LazyMessage) Reset()

func (*LazyMessage) String

func (m *LazyMessage) String() string

type LazyMethodDesc added in v2.202.0

type LazyMethodDesc struct {
	Name          string
	ClientStreams bool
	ServerStreams bool
}

type LazyStream added in v2.202.0

type LazyStream struct {
	// used to close the stream
	context.CancelFunc
	grpc.ClientStream
	// contains filtered or unexported fields
}

func (*LazyStream) Close added in v2.202.0

func (s *LazyStream) Close() (err error)

func (*LazyStream) ID added in v2.202.0

func (s *LazyStream) ID() uint64

func (*LazyStream) RecvMsg added in v2.202.0

func (s *LazyStream) RecvMsg(out proto.Message) (err error)

func (*LazyStream) SendMsg added in v2.202.0

func (s *LazyStream) SendMsg(in proto.Message) (err error)

type Listener

type Listener interface {
	manet.Listener

	GRPCMultiaddr() ma.Multiaddr
}

func Listen

func Listen(maddr ma.Multiaddr) (Listener, error)

type Server

type Server struct {
	GRPCServer *grpc.Server
	GatewayMux *grpcgw.ServeMux
	// contains filtered or unexported fields
}

func (*Server) Close added in v2.364.0

func (s *Server) Close() error

func (*Server) Serve

func (s *Server) Serve(l Listener) error

Jump to

Keyboard shortcuts

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