grpc

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 29 Imported by: 801

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dial

func Dial(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)

Dial returns a GRPC connection.

func DialInsecure

func DialInsecure(ctx context.Context, opts ...ClientOption) (*grpc.ClientConn, error)

DialInsecure returns an insecure GRPC connection.

func SetGlobalBalancer added in v2.1.0

func SetGlobalBalancer(scheme string, builder selector.Builder)

SetGlobalBalancer set grpc balancer with scheme.

Types

type Builder added in v2.1.0

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

Builder is grpc balancer builder.

func (*Builder) Build added in v2.1.0

func (b *Builder) Build(info base.PickerBuildInfo) gBalancer.Picker

Build creates a grpc Picker.

type ClientOption

type ClientOption func(o *clientOptions)

ClientOption is gRPC client option.

func WithBalancerName added in v2.1.0

func WithBalancerName(name string) ClientOption

WithBalancerName with balancer name

func WithDiscovery

func WithDiscovery(d registry.Discovery) ClientOption

WithDiscovery with client discovery.

func WithEndpoint

func WithEndpoint(endpoint string) ClientOption

WithEndpoint with client endpoint.

func WithMiddleware

func WithMiddleware(m ...middleware.Middleware) ClientOption

WithMiddleware with client middleware.

func WithNodeFilter added in v2.1.2

func WithNodeFilter(filters ...selector.NodeFilter) ClientOption

WithNodeFilter with select filters

func WithOptions

func WithOptions(opts ...grpc.DialOption) ClientOption

WithOptions with gRPC options.

func WithTLSConfig added in v2.0.5

func WithTLSConfig(c *tls.Config) ClientOption

WithTLSConfig with TLS config.

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOption

WithTimeout with client timeout.

func WithUnaryInterceptor

func WithUnaryInterceptor(in ...grpc.UnaryClientInterceptor) ClientOption

WithUnaryInterceptor returns a DialOption that specifies the interceptor for unary RPCs.

type Picker added in v2.1.0

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

Picker is a grpc picker.

func (*Picker) Pick added in v2.1.0

Pick pick instances.

type Server

type Server struct {
	*grpc.Server
	// contains filtered or unexported fields
}

Server is a gRPC server wrapper.

func NewServer

func NewServer(opts ...ServerOption) *Server

NewServer creates a gRPC server by options.

func (*Server) Endpoint

func (s *Server) Endpoint() (*url.URL, error)

Endpoint return a real address to registry endpoint. examples:

grpc://127.0.0.1:9000?isSecure=false

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start start the gRPC server.

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stop the gRPC server.

type ServerOption

type ServerOption func(o *Server)

ServerOption is gRPC server option.

func Address

func Address(addr string) ServerOption

Address with server address.

func Logger

func Logger(logger log.Logger) ServerOption

Logger with server logger.

func Middleware

func Middleware(m ...middleware.Middleware) ServerOption

Middleware with server middleware.

func Network

func Network(network string) ServerOption

Network with server network.

func Options

func Options(opts ...grpc.ServerOption) ServerOption

Options with grpc options.

func TLSConfig added in v2.0.5

func TLSConfig(c *tls.Config) ServerOption

TLSConfig with TLS config.

func Timeout

func Timeout(timeout time.Duration) ServerOption

Timeout with server timeout.

func UnaryInterceptor

func UnaryInterceptor(in ...grpc.UnaryServerInterceptor) ServerOption

UnaryInterceptor returns a ServerOption that sets the UnaryServerInterceptor for the server.

type Trailer added in v2.1.0

type Trailer metadata.MD

Trailer is a grpc trailder MD.

func (Trailer) Get added in v2.1.0

func (t Trailer) Get(k string) string

Get get a grpc trailer value.

type Transport

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

Transport is a gRPC transport.

func (*Transport) Endpoint

func (tr *Transport) Endpoint() string

Endpoint returns the transport endpoint.

func (*Transport) Kind

func (tr *Transport) Kind() transport.Kind

Kind returns the transport kind.

func (*Transport) NodeFilters added in v2.1.2

func (tr *Transport) NodeFilters() []selector.NodeFilter

Filters returns the client select filters.

func (*Transport) Operation

func (tr *Transport) Operation() string

Operation returns the transport operation.

func (*Transport) ReplyHeader

func (tr *Transport) ReplyHeader() transport.Header

ReplyHeader returns the reply header.

func (*Transport) RequestHeader

func (tr *Transport) RequestHeader() transport.Header

RequestHeader returns the request header.

Directories

Path Synopsis
resolver

Jump to

Keyboard shortcuts

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