flags

package
v0.0.0-...-f409b5d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Flags that can also be load in .env file
	Port        = flag.String("port", "8080", "RPC gateway port, e.g. 8080")
	Metrics     = flag.Bool("metrics", false, "Enable prometheus metrics")
	MetricsPort = flag.String("metricsPort", "", "Metrics server port")

	EnableRateLimit      = flag.Bool("enableRateLimit", false, "Enable rate limit")
	RateLimitWithoutAuth = flag.Int("rateLimitWithoutAuth", 100, "Rate limit per second without auth")
	RateLimitWithAuth    = flag.Int("rateLimitWithAuth", 0, "Rate limit per second with auth (0: no limit)")

	// Flags that do not exist in .env.example file
	Pprof   = flag.Bool("pprof", false, "Enable pprof")
	Replica = flag.Int("replica", 1, "replica rpcs to send request")

	CacheTTL               = flag.Uint("cache_ttl", 10, "Cache TTL in minutes")
	LogLevel               = flag.Int("logLevel", 1, "Log level, -1: trace, 0: debug, 1: info, 2: warn, 3: error, 4: fatal, 5: panic")
	LogCaller              = flag.Bool("logCaller", false, "Log caller")
	RPCTimeout             = flag.Int("rpcTimeout", 20, "RPC timeout in seconds")
	RPCHealthCheckInterval = flag.Int("rpcHealthCheckInterval", 1, "RPC health check interval in minutes")

	// Transformed flags for easier use
	AdditionalRPCs   = make(map[int64][]string)
	FallbackRPCs     = make(map[int64][]string)
	CacheableMethods = make(map[string]bool)
)

Functions

func Init

func Init()

Types

type RPC

type RPC struct {
	ChainID int64    `json:"chainID"`
	RPC     []string `json:"rpc"`
}

type RPCGroup

type RPCGroup []*RPC // e.g. `[{"chainID":1,"rpc":["https://eth.llamarpc.com","https://rpc.builder0x69.io"]}]`

func (RPCGroup) ToRPCMap

func (r RPCGroup) ToRPCMap() map[int64][]string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL