You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
689 B
23 lines
689 B
package config |
|
|
|
import ( |
|
"google.golang.org/grpc" |
|
"sonet/pkg/utils/conver" |
|
) |
|
|
|
func GetGrpcOptions(config GrpcConfig) (opts []grpc.ServerOption) { |
|
if config.MaxSendMsgSize != "" { |
|
opts = append(opts, grpc.MaxSendMsgSize(conver.MustParseDataUnitInt(config.MaxSendMsgSize))) |
|
} |
|
if config.MaxRecvMsgSize != "" { |
|
opts = append(opts, grpc.MaxSendMsgSize(conver.MustParseDataUnitInt(config.MaxRecvMsgSize))) |
|
} |
|
if config.ReadBufferSize != "" { |
|
opts = append(opts, grpc.MaxSendMsgSize(conver.MustParseDataUnitInt(config.ReadBufferSize))) |
|
} |
|
if config.WriteBufferSize != "" { |
|
opts = append(opts, grpc.MaxSendMsgSize(conver.MustParseDataUnitInt(config.WriteBufferSize))) |
|
} |
|
|
|
return |
|
}
|
|
|