xrpc

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MulanPSL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthUnaryServerInterceptor

func AuthUnaryServerInterceptor() grpc.UnaryServerInterceptor

func ChainStreamServer

func ChainStreamServer(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor

流式拦截器 ChainStreamServer creates a single interceptor out of a chain of many interceptort.

Execution is done in left-to-right order, including passing of context. For example ChainUnaryServer(one, two, three) will execute one before two before three. If you want to pass context between interceptors, use WrapServerStream.

While this can be useful in some scenarios, it is generally advisable to use google.golang.org/grpc.ChainStreamInterceptor directly.

func ChainUnaryServer

func ChainUnaryServer(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor

构建支持多个拦截器中间件

func EtcdRegister

func EtcdRegister(etcdHost, serviceName, addr string, ttl int64) error

func EtcdUnRegister

func EtcdUnRegister(serviceName, addr string) error

func LogUnaryServerInterceptor

func LogUnaryServerInterceptor() grpc.UnaryServerInterceptor

func NewClient

func NewClient(tls *Tls, addr string, opts ...grpc.DialOption) (conn *grpc.ClientConn, err error)

Types

type Server

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

func GetRpcServer

func GetRpcServer(tls *Tls, opt ...grpc.ServerOption) *Server

func (*Server) NewServer

func (t *Server) NewServer() (server *grpc.Server, err error)

func (*Server) Run

func (t *Server) Run(addr string) error

启动 GRPC 监听服务

func (*Server) Use

func (t *Server) Use(middleware ...grpc.UnaryServerInterceptor)

添加中间件

type Tls

type Tls struct {
	Crt   string
	Key   string
	CACrt string
}

Jump to

Keyboard shortcuts

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