grpcweb

package
v0.0.0-...-5b5a8c3 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BidiStream

type BidiStream interface {
	// Header returns the header metadata from the server, if there is any.
	// It blocks if the metadata is not ready to read.
	Header() (metadata.MD, error)
	// Trailer returns the trailer metadata from the server, if there is any.
	// It must only be called after stream.CloseAndReceive has returned, or
	// stream.Receive has returned a non-nil error (including io.EOF).
	Trailer() metadata.MD
	Send(ctx context.Context, req interface{}) error
	Receive(ctx context.Context, res interface{}) error
	CloseSend() error
}

type CallOption

type CallOption func(*callOptions)

func CallContentSubtype

func CallContentSubtype(contentSubtype string) CallOption
func Header(h *metadata.MD) CallOption

func Trailer

func Trailer(t *metadata.MD) CallOption

type ClientConn

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

func DialContext

func DialContext(host string, opts ...DialOption) (*ClientConn, error)

DialContext initializes a grpcweb Clientconn backed by a UnaryTransport

func (*ClientConn) Close

func (c *ClientConn) Close() error

func (*ClientConn) GetRemoteCertificate

func (c *ClientConn) GetRemoteCertificate() (*x509.Certificate, error)

func (*ClientConn) Invoke

func (c *ClientConn) Invoke(ctx context.Context, method string, args, reply interface{}, opts ...CallOption) error

Invoke uses grpcweb to call a given method with the passed in payload. Response is unmarshaled to the reply interface

func (*ClientConn) IsAlive

func (c *ClientConn) IsAlive() bool

IsAlive returns true if the transport has been established

func (*ClientConn) NewBidiStream

func (c *ClientConn) NewBidiStream(desc *grpc.StreamDesc, method string, opts ...CallOption) (BidiStream, error)

func (*ClientConn) NewClientStream

func (c *ClientConn) NewClientStream(desc *grpc.StreamDesc, method string, opts ...CallOption) (ClientStream, error)

func (*ClientConn) NewServerStream

func (c *ClientConn) NewServerStream(desc *grpc.StreamDesc, method string, opts ...CallOption) (ServerStream, error)

type ClientStream

type ClientStream interface {
	// Header returns the header metadata from the server, if there is any.
	// It blocks if the metadata is not ready to read.
	Header() (metadata.MD, error)
	// Trailer returns the trailer metadata from the server, if there is any.
	// It must only be called after stream.CloseAndReceive has returned, or
	// stream.Receive has returned a non-nil error (including io.EOF).
	Trailer() metadata.MD
	Send(ctx context.Context, req interface{}) error
	CloseAndReceive(ctx context.Context, res interface{}) error
}

type DialOption

type DialOption func(*DialOptions)

func WithDefaultCallOptions

func WithDefaultCallOptions(opts ...CallOption) DialOption

func WithExpectContinueTimeout

func WithExpectContinueTimeout(duration time.Duration) DialOption

func WithIdleConnTimeout

func WithIdleConnTimeout(duration time.Duration) DialOption

func WithInsecure

func WithInsecure() DialOption

func WithInsecureTlsVerification

func WithInsecureTlsVerification() DialOption

func WithSecure

func WithSecure() DialOption

func WithTlsCertificate

func WithTlsCertificate(cert []byte) DialOption

func WithTlsHandshakeTimeout

func WithTlsHandshakeTimeout(duration time.Duration) DialOption

func WithTransportCredentials

func WithTransportCredentials(creds credentials.TransportCredentials) DialOption

type DialOptions

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

type ServerStream

type ServerStream interface {
	// Header returns the header metadata from the server, if there is any.
	// It blocks if the metadata is not ready to read.
	Header() (metadata.MD, error)
	// Trailer returns the trailer metadata from the server, if there is any.
	// It must only be called after stream.CloseAndReceive has returned, or
	// stream.Receive has returned a non-nil error (including io.EOF).
	Trailer() metadata.MD
	Send(ctx context.Context, req interface{}) error
	Receive(ctx context.Context, res interface{}) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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