zrpc

package module
v0.1.34 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

README

zrpc

倍通内部rpc框架,基于gRPC

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Block

func Block() grpc.DialOption

func Insecure

func Insecure() grpc.DialOption

func MustNewClientConn added in v0.1.3

func MustNewClientConn(rpcClient rpc.Client, serverName string, opts ...COption) *grpc.ClientConn

MustNewClientConn 新建一个 Client 实例

Types

type COption

type COption func(*clientOption)

func WithClientInterceptor added in v0.1.3

func WithClientInterceptor(clientInterceptor ...grpc.UnaryClientInterceptor) COption

func WithDialOption

func WithDialOption(opts ...grpc.DialOption) COption

type Client

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

func MustNewClient

func MustNewClient(rpcClient rpc.Client, serverName string, opts ...COption) *Client

func (*Client) Coon

func (c *Client) Coon() *grpc.ClientConn

func (*Client) GetTarget added in v0.1.10

func (c *Client) GetTarget() string

type RegisterServer

type RegisterServer func(server *grpc.Server)

type SOption

type SOption func(*serverOption)

func WithServeZero added in v0.1.24

func WithServeZero() SOption

WithServeZero 设置服务启动运行在 0.0.0.0

func WithServerInterceptor added in v0.1.3

func WithServerInterceptor(serverInterceptor ...grpc.UnaryServerInterceptor) SOption

WithServerInterceptor 生成服务端拦截器

func WithServerOption

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

WithServerOption 通过 grpc.ServerOption 生成 SOption

type Server

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

func MustNewServer

func MustNewServer(ctx context.Context, server rpc.Server, registerServer RegisterServer, serverOptions ...SOption) *Server

func (*Server) Serve

func (s *Server) Serve() error

Serve 启动服务

func (*Server) ServerEndpoint added in v0.1.24

func (s *Server) ServerEndpoint() string

ServerEndpoint 服务真正运行的 endpoint

func (*Server) StopServe

func (s *Server) StopServe()

StopServe 停止服务

Jump to

Keyboard shortcuts

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