grpc

package
v0.0.0-...-04e6e7a Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StreamInterceptorChain

func StreamInterceptorChain(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor

StreamInterceptorChain returns stream interceptors chain.

func UnaryInterceptorChain

func UnaryInterceptorChain(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor

UnaryInterceptorChain returns interceptors chain.

Types

type Config

type Config struct {
	Debug               bool   // 是否开启调试
	Network             string // net.listen的network类型
	Host                string // 服务ip
	Port                int    // 服务端口
	PlainTextAddress    string // 注册中心显示的地址
	Version             string // 当前项目版本号
	Name                string // 服务名称
	TLS                 bool   // 是否使用tls连接
	CertFile            string // tls的cert文件路径
	KeyFile             string // tls的key文件路径
	ServerSlowThreshold int64  // 服务器素速度阈值
	// contains filtered or unexported fields
}

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig 默认配置

func RawConfig

func RawConfig(key string) *Config

RawConfig 读取配置

func ScanConfig

func ScanConfig(name string) *Config

ScanConfig 从config组件读取配置

func (*Config) Address

func (c *Config) Address() string

Address 获取服务地址

func (*Config) Build

func (c *Config) Build() *grpcServer

Build 构建grpc服务

func (*Config) WithLogger

func (c *Config) WithLogger(log *logger.Logger) *Config

WithLogger 重新设置日志组件

func (*Config) WithServerOption

func (c *Config) WithServerOption(opts ...grpc.ServerOption) *Config

WithServerOption 设置grpc服务参数

func (*Config) WithStreamInterceptor

func (c *Config) WithStreamInterceptor(opts ...grpc.StreamServerInterceptor) *Config

WithStreamInterceptor 设置拦截 stream

func (*Config) WithUnaryInterceptor

func (c *Config) WithUnaryInterceptor(opts ...grpc.UnaryServerInterceptor) *Config

WithUnaryInterceptor 设置拦截 unary(一元) RPC

Jump to

Keyboard shortcuts

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