rpc

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client 客户端

func NewClient

func NewClient(conf *Config) *Client

NewClient 新建客户端

func (*Client) Dial

func (c *Client) Dial(ctx context.Context, scode string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

Dial 用于创建连接

func (*Client) UseDialOption

func (c *Client) UseDialOption(opts ...grpc.DialOption) *Client

UseDialOption 用于添加自定义连接参数

func (*Client) UseStreamInterceptor

func (c *Client) UseStreamInterceptor(handlers ...grpc.StreamClientInterceptor) *Client

UseStreamInterceptor 用于添加自定义客户端流拦截器

func (*Client) UseUnaryInterceptor

func (c *Client) UseUnaryInterceptor(handlers ...grpc.UnaryClientInterceptor) *Client

UseUnaryInterceptor 用于添加自定义客户端一元拦截器

type Config

type Config struct {
	GRPCAddress string
	HTTPAddress string

	KeepaliveTimeout time.Duration

	// client
	Scheme      string
	Authority   string
	APIEndpoint string

	// tls
	TLS TLSConfig

	// 默认开启 http 与 grpc 服务
	DisableGRPCServer bool
	DisableHTTPServer bool
	// contains filtered or unexported fields
}

Config server config

func NewConfig

func NewConfig(l *logrus.Entry) *Config

NewConfig xx

type Server

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

Server server instance

func NewServer

func NewServer(c *Config) *Server

NewServer returns Server instance

func (*Server) RegisterGateway

func (s *Server) RegisterGateway(mux *http.ServeMux) error

RegisterGateway return the http server for registering service

func (*Server) Server

func (s *Server) Server() *grpc.Server

Server return the grpc server for registering service

func (*Server) Shutdown

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

Shutdown graceful stop server

func (*Server) StartBackground

func (s *Server) StartBackground() error

StartBackground xx

func (*Server) UseServerOption

func (s *Server) UseServerOption(opts ...grpc.ServerOption) *Server

UseServerOption 用于设置选项并初始化grpc server

type TLSConfig

type TLSConfig struct {
	// HTTPCertFile 用于 HTTP 网关证书
	HTTPCertFile string
	HTTPKeyFile  string

	// GRPCCertFile 用于 GRPC 网关证书
	GRPCCertFile string
	GRPCKeyFile  string
	// 用于验证客户端证书有效性,既:http_service.tls_client.cert_file 所签发的 ca 证书
	GRPCCAFile string

	// 用于基于 acme 协议的自动化证书申请
	ACMEServer   string
	ACMEEmail    string
	ACMEDomains  []string
	ACMECacheDir string
}

TLSConfig xx

Jump to

Keyboard shortcuts

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