util

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: LGPL-3.0 Imports: 11 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 GetSecret

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

func SendTelegramMessage

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

Types

type AdminConfig

type AdminConfig struct {
	ListenAddr string `json:"listen_addr"`
}

func (*AdminConfig) Validate

func (cfg *AdminConfig) Validate()

type AlertConfig

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

	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 BBCConfig

type BBCConfig struct {
	RpcAddrs                                   []string `json:"rpc_addrs"`
	MnemonicType                               string   `json:"mnemonic_type"`
	AWSRegion                                  string   `json:"aws_region"`
	AWSSecretName                              string   `json:"aws_secret_name"`
	Mnemonic                                   string   `json:"mnemonic"`
	SleepMillisecondForWaitBlock               int64    `json:"sleep_millisecond_for_wait_block"`
	CleanUpBlockInterval                       uint64   `json:"clean_up_block_interval"`
	BlockIntervalForCleanUpUndeliveredPackages uint64   `json:"block_interval_for_clean_up_undelivered_packages"`
	BehindBlockThreshold                       uint64   `json:"behind_block_threshold"`
}

func (*BBCConfig) Validate

func (cfg *BBCConfig) Validate()

type BSCConfig

type BSCConfig struct {
	KeyType             string   `json:"key_type"`
	AWSRegion           string   `json:"aws_region"`
	AWSSecretName       string   `json:"aws_secret_name"`
	PrivateKey          string   `json:"private_key"`
	Providers           []string `json:"providers"`
	GasLimit            uint64   `json:"gas_limit"`
	GasPrice            uint64   `json:"gas_price"`
	MonitorDataSeedList []string `json:"monitor_data_seed_list"`
}

func (*BSCConfig) Validate

func (cfg *BSCConfig) Validate()

type ChannelConfig

type ChannelConfig struct {
	ChannelID      int8           `json:"channel_id"`
	Method         string         `json:"method"`
	ABIName        string         `json:"abi_name"`
	ContractAddr   common.Address `json:"contract_addr"`
	SequenceMethod string         `json:"sequence_method"`
}

type Config

type Config struct {
	CrossChainConfig CrossChainConfig `json:"cross_chain_config"`
	BBCConfig        BBCConfig        `json:"bbc_config"`
	BSCConfig        BSCConfig        `json:"bsc_config"`
	LogConfig        LogConfig        `json:"log_config"`
	AdminConfig      AdminConfig      `json:"admin_config"`
	AlertConfig      AlertConfig      `json:"alert_config"`
	DBConfig         DBConfig         `json:"db_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 {
	SourceChainID      uint16  `json:"source_chain_id"`
	DestChainID        uint16  `json:"dest_chain_id"`
	MonitorChannelList []uint8 `json:"monitor_channel_list"`
	CompetitionMode    bool    `json:"competition_mode"`
}

func (*CrossChainConfig) Validate

func (cfg *CrossChainConfig) Validate()

type DBConfig

type DBConfig struct {
	Dialect string `json:"dialect"`
	DBPath  string `json:"db_path"`
}

func (*DBConfig) Validate

func (cfg *DBConfig) 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