grpc

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: MIT Imports: 27 Imported by: 0

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)

func DialInsecure

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

func NewWrappedStream

func NewWrappedStream(ctx context.Context, stream grpc.ServerStream) grpc.ServerStream

Types

type ClientOption

type ClientOption func(o *client)

func WithClientDialOptions

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

func WithClientDiscovery

func WithClientDiscovery(d registry.Discovery) ClientOption

func WithClientEndpoint

func WithClientEndpoint(endpoint string) ClientOption

func WithClientMiddleware

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

func WithClientTLSConfig

func WithClientTLSConfig(c *tls.Config) ClientOption

func WithClientTimeout

func WithClientTimeout(timeout time.Duration) ClientOption

func WithClientUnaryInterceptor

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

type Server

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

func NewServer

func NewServer(opts ...ServerOption) *Server

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

func (*Server) Stop

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

func (*Server) Use

func (s *Server) Use(selector string, m ...middleware.Middleware)

Use uses a service middleware with selector. selector:

  • '/*'
  • '/helloworld.v1.Greeter/*'
  • '/helloworld.v1.Greeter/SayHello'

type ServerOption

type ServerOption func(o *Server)

func WithServerAddress

func WithServerAddress(addr string) ServerOption

WithServerAddress with server address like `0.0.0.0:9000`. default is `:0`

func WithServerListener

func WithServerListener(lis net.Listener) ServerOption

WithServerListener with server lis

func WithServerMiddleware

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

WithServerMiddleware with server middleware.

func WithServerNetwork

func WithServerNetwork(network string) ServerOption

WithServerNetwork with server network. default is `tcp`

func WithServerOption

func WithServerOption(opts ...grpc.ServerOption) ServerOption

WithServerOption with grpc options.

func WithServerTLSConfig

func WithServerTLSConfig(c *tls.Config) ServerOption

WithServerTLSConfig with TLS config.

func WithServerTimeout

func WithServerTimeout(timeout time.Duration) ServerOption

WithServerTimeout with server timeout.

type Transport

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

func (*Transport) Endpoint

func (t *Transport) Endpoint() string

func (*Transport) Kind

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

func (*Transport) Operation

func (t *Transport) Operation() string

func (*Transport) ReplyHeader

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

func (*Transport) RequestHeader

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

Directories

Path Synopsis
balancer
p2c
resolver

Jump to

Keyboard shortcuts

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