berty: berty.tech/berty/go/internal/grpcutil Index | Files

package grpcutil

import "berty.tech/berty/go/internal/grpcutil"

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

Index

Package Files

buf_listener.go doc.go lazy_client.go lazy_codec.go lazy_message.go server.go simple_auth.go

Constants

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

BertyCustomPrefix is a multiformat custom prefix

func NewUnsecureSimpleAuthAccess Uses

func NewUnsecureSimpleAuthAccess(scheme, token string) credentials.PerRPCCredentials

NewUnsecureSimpleAuthAccess constructs the PerRPCCredentials using a given token.

type BufListener Uses

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

func NewBufListener Uses

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

func (*BufListener) NewClientConn Uses

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

type LazyClient Uses

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

func NewLazyClient Uses

func NewLazyClient(cc *grpc.ClientConn) *LazyClient

func (*LazyClient) InvokeStream Uses

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

func (*LazyClient) InvokeUnary Uses

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

type LazyCodec Uses

type LazyCodec struct{}

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

func NewLazyCodec Uses

func NewLazyCodec() *LazyCodec

func (*LazyCodec) Marshal Uses

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

func (*LazyCodec) Name Uses

func (lc *LazyCodec) Name() string

func (*LazyCodec) String Uses

func (lc *LazyCodec) String() string

func (*LazyCodec) Unmarshal Uses

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

type LazyMessage Uses

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 Uses

func NewLazyMessage() *LazyMessage

func (*LazyMessage) Base64 Uses

func (m *LazyMessage) Base64() string

func (*LazyMessage) Bytes Uses

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

func (*LazyMessage) FromBase64 Uses

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

func (*LazyMessage) FromBytes Uses

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

func (*LazyMessage) ProtoMessage Uses

func (m *LazyMessage) ProtoMessage()

func (*LazyMessage) Reset Uses

func (m *LazyMessage) Reset()

func (*LazyMessage) String Uses

func (m *LazyMessage) String() string

type LazyMethodDesc Uses

type LazyMethodDesc struct {
    Name          string
    ClientStreams bool
    ServerStreams bool
}

type LazyStream Uses

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

func (*LazyStream) Close Uses

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

func (*LazyStream) ID Uses

func (s *LazyStream) ID() uint64

func (*LazyStream) RecvMsg Uses

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

func (*LazyStream) SendMsg Uses

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

type Listener Uses

type Listener interface {
    manet.Listener

    GRPCMultiaddr() ma.Multiaddr
}

func Listen Uses

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

type Server Uses

type Server struct {
    GRPCServer *grpc.Server
    GatewayMux *grpcgw.ServeMux
}

func (*Server) Serve Uses

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

Package grpcutil imports 15 packages (graph). Updated 2021-01-22. Refresh now. Tools for package owners.