Documentation ¶
Index ¶
- Constants
- type Component
- func (c *Component) Address() string
- func (c *Component) GracefulStop(ctx context.Context) error
- func (c *Component) Info() *server.ServiceInfo
- func (c *Component) Init() error
- func (c *Component) Listener() net.Listener
- func (c *Component) Name() string
- func (c *Component) PackageName() string
- func (c *Component) Start() error
- func (c *Component) Stop() error
- type Config
- type Container
- type Option
- func WithLogger(logger *elog.Component) Option
- func WithNetwork(network string) Option
- func WithServerOption(options ...grpc.ServerOption) Option
- func WithStreamInterceptor(interceptors ...grpc.StreamServerInterceptor) Option
- func WithUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor) Option
Constants ¶
View Source
const PackageName = "server.egrpc"
PackageName 包名
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
Component ...
func (*Component) GracefulStop ¶
GracefulStop implements server.Component interface it will stop echo server gracefully
func (*Component) Info ¶
func (c *Component) Info() *server.ServiceInfo
Info returns server info, used by governor and consumer balancer
type Config ¶
type Config struct { Host string // IP地址,默认0.0.0.0 Port int // Port端口,默认9002 Deployment string // 部署区域 Network string // 网络类型,默认tcp4 EnableMetricInterceptor bool // 是否开启监控,默认开启 EnableTraceInterceptor bool // 是否开启链路追踪,默认开启 EnableOfficialGrpcLog bool // 是否开启官方grpc日志,默认关闭 EnableSkipHealthLog bool // 是否屏蔽探活日志,默认关闭 SlowLogThreshold time.Duration // 服务慢日志,默认500ms EnableAccessInterceptor bool // 是否开启,记录请求数据 EnableAccessInterceptorReq bool // 是否开启记录请求参数,默认不开启 EnableAccessInterceptorRes bool // 是否开启记录响应参数,默认不开启 EnableLocalMainIP bool // 自动获取ip地址 // contains filtered or unexported fields }
Config ...
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig represents default config User should construct config base on DefaultConfig
type Option ¶
type Option func(c *Container)
Option 可选项
func WithLogger ¶ added in v0.7.0
WithLogger inject logger
func WithNetwork ¶ added in v0.6.12
WithNetwork inject network
func WithServerOption ¶
func WithServerOption(options ...grpc.ServerOption) Option
WithServerOption inject server option to grpc server User should not inject interceptor option, which is recommend by WithStreamInterceptor and WithUnaryInterceptor
func WithStreamInterceptor ¶
func WithStreamInterceptor(interceptors ...grpc.StreamServerInterceptor) Option
WithStreamInterceptor inject stream interceptors to server option
func WithUnaryInterceptor ¶
func WithUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor) Option
WithUnaryInterceptor inject unary interceptors to server option
Click to show internal directories.
Click to hide internal directories.