github.com/0xPolygon/supernets2-node@v0.0.0-20230711153321-2fe574524eaa/jsonrpc/config.go (about)

     1  package jsonrpc
     2  
     3  import "github.com/0xPolygon/supernets2-node/config/types"
     4  
     5  // Config represents the configuration of the json rpc
     6  type Config struct {
     7  	// Host defines the network adapter that will be used to serve the HTTP requests
     8  	Host string `mapstructure:"Host"`
     9  
    10  	// Port defines the port to serve the endpoints via HTTP
    11  	Port int `mapstructure:"Port"`
    12  
    13  	// ReadTimeout is the HTTP server read timeout
    14  	// check net/http.server.ReadTimeout and net/http.server.ReadHeaderTimeout
    15  	ReadTimeout types.Duration `mapstructure:"ReadTimeout"`
    16  
    17  	// WriteTimeout is the HTTP server write timeout
    18  	// check net/http.server.WriteTimeout
    19  	WriteTimeout types.Duration `mapstructure:"WriteTimeout"`
    20  
    21  	// MaxRequestsPerIPAndSecond defines how much requests a single IP can
    22  	// send within a single second
    23  	MaxRequestsPerIPAndSecond float64 `mapstructure:"MaxRequestsPerIPAndSecond"`
    24  
    25  	// SequencerNodeURI is used allow Non-Sequencer nodes
    26  	// to relay transactions to the Sequencer node
    27  	SequencerNodeURI string `mapstructure:"SequencerNodeURI"`
    28  
    29  	// MaxCumulativeGasUsed is the max gas allowed per batch
    30  	MaxCumulativeGasUsed uint64
    31  
    32  	// WebSockets configuration
    33  	WebSockets WebSocketsConfig `mapstructure:"WebSockets"`
    34  
    35  	// EnableL2SuggestedGasPricePolling enables polling of the L2 gas price to block tx in the RPC with lower gas price.
    36  	EnableL2SuggestedGasPricePolling bool `mapstructure:"EnableL2SuggestedGasPricePolling"`
    37  }
    38  
    39  // WebSocketsConfig has parameters to config the rpc websocket support
    40  type WebSocketsConfig struct {
    41  	// Enabled defines if the WebSocket requests are enabled or disabled
    42  	Enabled bool `mapstructure:"Enabled"`
    43  
    44  	// Host defines the network adapter that will be used to serve the WS requests
    45  	Host string `mapstructure:"Host"`
    46  
    47  	// Port defines the port to serve the endpoints via WS
    48  	Port int `mapstructure:"Port"`
    49  }