util

package
v0.0.0-...-e273ca0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2023 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBDialectMysql         = "mysql"
	DBDialectSqlite3       = "sqlite3"
	LocalConfig            = "local"
	AWSConfig              = "aws"
	KeyTypeLocalPrivateKey = "local_private_key"
	KeyTypeAWSPrivateKey   = "aws_private_key"

	KeyTypeMnemonic    = "local_mnemonic"
	KeyTypeAWSMnemonic = "aws_mnemonic"
)

Variables

This section is empty.

Functions

func GetCurrentAbPath

func GetCurrentAbPath() string

getCurrentAbPath

func GetSecret

func GetSecret(secretName, region string) (string, error)

func SendTelegramMessage

func SendTelegramMessage(identity string, botId string, chatId string, msg string)

Types

type AlertConfig

type AlertConfig struct {
	EnableAlert     bool  `json:"enable_alert"`
	EnableHeartBeat bool  `json:"enable_heart_beat"`
	Interval        int64 `json:"interval"`

	Identity       string `json:"identity"`
	TelegramBotId  string `json:"telegram_bot_id"`
	TelegramChatId string `json:"telegram_chat_id"`

	BalanceThreshold     string `json:"balance_threshold"`
	SequenceGapThreshold uint64 `json:"sequence_gap_threshold"`
}

func (*AlertConfig) Validate

func (cfg *AlertConfig) Validate()

type BTCConfig

type BTCConfig struct {
	RpcAddrs                     []BTCRpcAddrs `json:"rpc_addrs"`
	SleepSecond                  uint64        `json:"sleep_second"`
	DataSeedDenyServiceThreshold float64       `json:"data_seed_deny_service_threshold"`
}

func (*BTCConfig) Validate

func (cfg *BTCConfig) Validate()

type BTCRpcAddrs

type BTCRpcAddrs struct {
	Host string `json:"host"`
	User string `json:"user"`
	Pass string `json:"pass"`
}

type COREConfig

type COREConfig struct {
	PrivateKey                   string   `json:"private_key"`
	Providers                    []string `json:"providers"`
	GasLimit                     uint64   `json:"gas_limit"`
	GasPrice                     uint64   `json:"gas_price"`
	GasIncrease                  uint64   `json:"gas_increase"`
	SleepSecond                  uint64   `json:"sleep_second"`
	DataSeedDenyServiceThreshold float64  `json:"data_seed_deny_service_threshold"`
}

func (*COREConfig) Validate

func (cfg *COREConfig) Validate()

type Config

type Config struct {
	CrossChainConfig CrossChainConfig `json:"cross_chain_config"`
	BTCConfig        BTCConfig        `json:"btc_config"`
	COREConfig       COREConfig       `json:"core_config"`
	LogConfig        LogConfig        `json:"log_config"`
	AlertConfig      AlertConfig      `json:"alert_config"`
}

func ParseConfigFromFile

func ParseConfigFromFile(filePath string) *Config

func ParseConfigFromJson

func ParseConfigFromJson(content string) *Config

func (*Config) Validate

func (cfg *Config) Validate()

type CrossChainConfig

type CrossChainConfig struct {
	RecursionHeight int64 `json:"recursion_height"`
}

func (*CrossChainConfig) Validate

func (cfg *CrossChainConfig) Validate()

type LogConfig

type LogConfig struct {
	Level                        string `json:"level"`
	Filename                     string `json:"filename"`
	MaxFileSizeInMB              int    `json:"max_file_size_in_mb"`
	MaxBackupsOfLogFiles         int    `json:"max_backups_of_log_files"`
	MaxAgeToRetainLogFilesInDays int    `json:"max_age_to_retain_log_files_in_days"`
	UseConsoleLogger             bool   `json:"use_console_logger"`
	UseFileLogger                bool   `json:"use_file_logger"`
	Compress                     bool   `json:"compress"`
}

func (*LogConfig) Validate

func (cfg *LogConfig) Validate()

Jump to

Keyboard shortcuts

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