gRPC: add keepalive option PermitWithoutStream

This commit is contained in:
hmol233 2021-07-05 21:25:21 +08:00
parent 57b9006d26
commit 31c7141fef
No known key found for this signature in database
GPG key ID: D617A9DAB0C992D5
4 changed files with 37 additions and 21 deletions

View file

@ -7,10 +7,11 @@ import (
)
type GRPCConfig struct {
ServiceName string `json:"serviceName" `
MultiMode bool `json:"multiMode"`
IdleTimeout int32 `json:"idle_timeout"`
HealthCheckTimeout int32 `json:"health_check_timeout"`
ServiceName string `json:"serviceName" `
MultiMode bool `json:"multiMode"`
IdleTimeout int32 `json:"idle_timeout"`
HealthCheckTimeout int32 `json:"health_check_timeout"`
PermitWithoutStream bool `json:"permit_without_stream"`
}
func (g *GRPCConfig) Build() (proto.Message, error) {
@ -21,9 +22,10 @@ func (g *GRPCConfig) Build() (proto.Message, error) {
g.HealthCheckTimeout = 0
}
return &grpc.Config{
ServiceName: g.ServiceName,
MultiMode: g.MultiMode,
IdleTimeout: g.IdleTimeout,
HealthCheckTimeout: g.HealthCheckTimeout,
ServiceName: g.ServiceName,
MultiMode: g.MultiMode,
IdleTimeout: g.IdleTimeout,
HealthCheckTimeout: g.HealthCheckTimeout,
PermitWithoutStream: g.PermitWithoutStream,
}, nil
}