github.com/okex/exchain@v1.8.0/libs/tendermint/config/config_grpc.go (about)

     1  package config
     2  
     3  import "math"
     4  
     5  const (
     6  	defaultMinGasPrices = ""
     7  
     8  	// DefaultAPIAddress defines the default address to bind the API server to.
     9  	DefaultAPIAddress = "tcp://0.0.0.0:1317"
    10  
    11  	// DefaultGRPCAddress defines the default address to bind the gRPC server to.
    12  	DefaultGRPCAddress = "0.0.0.0:9090"
    13  
    14  	// DefaultGRPCWebAddress defines the default address to bind the gRPC-web server to.
    15  	DefaultGRPCWebAddress = "0.0.0.0:9091"
    16  
    17  	// DefaultGRPCMaxRecvMsgSize defines the default gRPC max message size in
    18  	// bytes the server can receive.
    19  	DefaultGRPCMaxRecvMsgSize = 1024 * 1024 * 10
    20  
    21  	// DefaultGRPCMaxSendMsgSize defines the default gRPC max message size in
    22  	// bytes the server can send.
    23  	DefaultGRPCMaxSendMsgSize = math.MaxInt32
    24  )
    25  
    26  // GRPCConfig defines configuration for the gRPC server.
    27  type GRPCConfig struct {
    28  	// Enable defines if the gRPC server should be enabled.
    29  	Enable bool `mapstructure:"enable"`
    30  
    31  	// Address defines the API server to listen on
    32  	Address string `mapstructure:"address"`
    33  
    34  	// MaxRecvMsgSize defines the max message size in bytes the server can receive.
    35  	// The default value is 10MB.
    36  	MaxRecvMsgSize int `mapstructure:"max-recv-msg-size"`
    37  
    38  	// MaxSendMsgSize defines the max message size in bytes the server can send.
    39  	// The default value is math.MaxInt32.
    40  	MaxSendMsgSize int `mapstructure:"max-send-msg-size"`
    41  }
    42  
    43  func DefaultGRPCConfig() GRPCConfig {
    44  	ret := GRPCConfig{
    45  		Enable:         true,
    46  		Address:        DefaultGRPCAddress,
    47  		MaxRecvMsgSize: DefaultGRPCMaxRecvMsgSize,
    48  		MaxSendMsgSize: DefaultGRPCMaxSendMsgSize,
    49  	}
    50  	return ret
    51  }