grpc

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 11 Imported by: 0

README

gRPC

server/grpc 中基于 Google gRPC 框架实现了 Server,用以注册 grpc 到 dove.Server() 中。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWrappedStream

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

Types

type Server

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

func NewServer

func NewServer(opts ...ServerOption) *Server

NewServer 新建 gRPC 服务器。

func (*Server) Start

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

Start 启动 gRPC 服务器。

func (*Server) Stop

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

Stop 停止 gRPC 服务器。

type ServerOption

type ServerOption func(s *Server)

func Address

func Address(address string) ServerOption

Address 配置服务监听地址。

func Options

func Options(grpcOpts ...grpc.ServerOption) ServerOption

Options 配置 gRPC 选项。

func StreamInterceptor

func StreamInterceptor(in ...grpc.StreamServerInterceptor) ServerOption

StreamInterceptor 配置流拦截器。

func TLSConfig

func TLSConfig(c *tls.Config) ServerOption

TLSConfig 配置 TLS。

func Timeout

func Timeout(timeout time.Duration) ServerOption

Timeout 配置服务超时时间(单位:秒)。

func UnaryInterceptor

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

UnaryInterceptor 配置一元拦截器。

Jump to

Keyboard shortcuts

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