config

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MinWaitingChainHeadStableDuration = time.Second * 2
	MaxWaitingChainHeadStableDuration = time.Second * 25
	DefWaitingChainHeadStableDuration = time.Second * 8
)
View Source
const (
	DefaultTimeout         = time.Second
	SignMessageTimeout     = time.Second * 3
	EstimateMessageTimeout = time.Second * 30
)

Variables

This section is empty.

Functions

func Exist

func Exist(path string) (bool, error)

Types

type APIConfig

type APIConfig struct {
	Address string
}

type Config

type Config struct {
	DB             DbConfig               `toml:"db"`
	JWT            JWTConfig              `toml:"jwt"`
	Log            LogConfig              `toml:"log"`
	API            APIConfig              `toml:"api"`
	Node           NodeConfig             `toml:"node"`
	MessageService MessageServiceConfig   `toml:"messageService"`
	Gateway        GatewayConfig          `toml:"gateway"`
	RateLimit      RateLimitConfig        `toml:"rateLimit"`
	Trace          *metrics.TraceConfig   `toml:"tracing"`
	Metrics        *metrics.MetricsConfig `toml:"metrics"`
	Libp2pNet      *Libp2pNetConfig       `toml:"libp2p"`
	Publisher      *PublisherConfig       `toml:"publisher"`
}

func DefaultConfig

func DefaultConfig() *Config

type DbConfig

type DbConfig struct {
	Type   string       `toml:"type"`
	MySql  MySqlConfig  `toml:"mysql"`
	Sqlite SqliteConfig `toml:"sqlite"`
}

type GatewayConfig

type GatewayConfig struct {
	Token string   `toml:"token"`
	Url   []string `toml:"url"`
}

type JWTConfig

type JWTConfig struct {
	AuthURL string `toml:"authURL"`
	Token   string `toml:"token"`
}

type Libp2pNetConfig

type Libp2pNetConfig struct {
	ListenAddress      string   `toml:"listenAddresses"`
	BootstrapAddresses []string `toml:"bootstrapAddresses"`

	// MinPeerThreshold determine when to expand peers.
	// default set to 0 which means use network default config.
	MinPeerThreshold int `toml:"minPeerThreshold"`

	// ExpandPeriod determine how often to expand peers.
	// default set to "0s" which means use network default config.
	// otherwise, it should be a duration string like "5s", "30s".
	ExpandPeriod time.Duration `toml:"expandPeriod"`
}

type LogConfig

type LogConfig struct {
	Path  string `toml:"path"`
	Level string `toml:"level"`
}

type MessageServiceConfig

type MessageServiceConfig struct {
	WaitingChainHeadStableDuration time.Duration `toml:"WaitingChainHeadStableDuration"`

	DefaultTimeout         time.Duration `toml:"DefaultTimeout"`
	SignMessageTimeout     time.Duration `toml:"SignMessageTimeout"`
	EstimateMessageTimeout time.Duration `toml:"EstimateMessageTimeout"`

	SkipProcessHead bool `toml:"skipProcessHead"`
	SkipPushMessage bool `toml:"skipPushMessage"`
}

type MessageStateConfig

type MessageStateConfig struct {
	BackTime int `toml:"backTime"` // 向前找多久的数据写到内存,单位秒

	DefaultExpiration, CleanupInterval int // message 缓存的有效时间和清理间隔
}

type MySqlConfig

type MySqlConfig struct {
	ConnectionString string        `toml:"connectionString"`
	MaxOpenConn      int           `toml:"maxOpenConn"`
	MaxIdleConn      int           `toml:"maxIdleConn"`
	ConnMaxLifeTime  time.Duration `toml:"connMaxLifeTime"`
	Debug            bool          `toml:"debug"`
}

type NodeConfig

type NodeConfig struct {
	Url   string `toml:"url"`
	Token string `toml:"token"`
}

type PublisherConfig

type PublisherConfig struct {
	// CacheReleasePeriod is the period to release massage cache with unit of second.
	// default is 5.
	// set a negative int means disable cache.
	Concurrency int `toml:"concurrency"`

	// CacheReleasePeriod is the period to release massage cache with unit of second.
	// default is 0 which means auto decide by network parameters that is 1/3 of the block time.
	// set a negative int means disable cache
	CacheReleasePeriod int64 `toml:"cacheReleasePeriod"`

	EnableP2P       bool `toml:"enablePubsub"`
	EnableMultiNode bool `toml:"enableMultiNode"`
}

type RateLimitConfig

type RateLimitConfig struct {
	Redis string `toml:"redis"`
}

type SqliteConfig

type SqliteConfig struct {
	Debug bool `toml:"debug"`
}

Jump to

Keyboard shortcuts

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