Documentation ¶
Index ¶
- Variables
- func GetSecret(secretName, region string) (string, error)
- func InitLogger(config LogConfig)
- func InitTgAlerter(cfg AlertConfig)
- func SendTelegramMessage(msg string)
- type AdminConfig
- type AlertConfig
- type ChainConfig
- type Config
- type DBConfig
- type HmacSigner
- type KeyConfig
- type KeyManagerConfig
- type LogConfig
- type Signer
- type TgAlerter
- type TokenSecretKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Logger instance for quick declarative logging levels Logger = logging.MustGetLogger("deputy") SdkLogger = &sdkLogger{} )
Functions ¶
func InitTgAlerter ¶
func InitTgAlerter(cfg AlertConfig)
func SendTelegramMessage ¶
func SendTelegramMessage(msg string)
Types ¶
type AdminConfig ¶
type AdminConfig struct {
ListenAddr string `json:"listen_addr"`
}
type AlertConfig ¶
type AlertConfig struct { TelegramBotId string `json:"telegram_bot_id"` TelegramChatId string `json:"telegram_chat_id"` BlockUpdateTimeout int64 `json:"block_update_timeout"` }
func (AlertConfig) Validate ¶
func (cfg AlertConfig) Validate()
type ChainConfig ¶
type ChainConfig struct { BalanceMonitorInterval int64 `json:"balance_monitor_interval"` BSCObserverFetchInterval int64 `json:"bsc_observer_fetch_interval"` BSCStartHeight int64 `json:"bsc_start_height"` BSCProvider string `json:"bsc_provider"` BSCConfirmNum int64 `json:"bsc_confirm_num"` BSCSwapAgentAddr string `json:"bsc_swap_agent_addr"` BSCExplorerUrl string `json:"bsc_explorer_url"` BSCMaxTrackRetry int64 `json:"bsc_max_track_retry"` BSCAlertThreshold string `json:"bsc_alert_threshold"` BSCWaitMilliSecBetweenSwaps int64 `json:"bsc_wait_milli_sec_between_swaps"` ETHObserverFetchInterval int64 `json:"eth_observer_fetch_interval"` ETHStartHeight int64 `json:"eth_start_height"` ETHProvider string `json:"eth_provider"` ETHConfirmNum int64 `json:"eth_confirm_num"` ETHSwapAgentAddr string `json:"eth_swap_agent_addr"` ETHExplorerUrl string `json:"eth_explorer_url"` ETHMaxTrackRetry int64 `json:"eth_max_track_retry"` ETHAlertThreshold string `json:"eth_alert_threshold"` ETHWaitMilliSecBetweenSwaps int64 `json:"eth_wait_milli_sec_between_swaps"` }
func (ChainConfig) Validate ¶
func (cfg ChainConfig) Validate()
type Config ¶
type Config struct { KeyManagerConfig KeyManagerConfig `json:"key_manager_config"` DBConfig DBConfig `json:"db_config"` ChainConfig ChainConfig `json:"chain_config"` LogConfig LogConfig `json:"log_config"` AlertConfig AlertConfig `json:"alert_config"` AdminConfig AdminConfig `json:"admin_config"` }
func ParseConfigFromFile ¶
func ParseConfigFromJson ¶
type HmacSigner ¶
hmacSigner uses HMAC SHA256 for signing payloads.
func NewHmacSigner ¶
func NewHmacSigner(apiKey string, secretKey string) *HmacSigner
func NewHmacSignerFromConfig ¶
func NewHmacSignerFromConfig(config *Config) (*HmacSigner, error)
func (*HmacSigner) Sign ¶
func (hs *HmacSigner) Sign(payload []byte) string
Sign signs provided payload and returns encoded string sum.
type KeyManagerConfig ¶
type KeyManagerConfig struct { KeyType string `json:"key_type"` AWSRegion string `json:"aws_region"` AWSSecretName string `json:"aws_secret_name"` // local keys LocalHMACKey string `json:"local_hmac_key"` LocalBSCPrivateKey string `json:"local_bsc_private_key"` LocalETHPrivateKey string `json:"local_eth_private_key"` LocalAdminApiKey string `json:"local_admin_api_key"` LocalAdminSecretKey string `json:"local_admin_secret_key"` }
func (KeyManagerConfig) Validate ¶
func (cfg KeyManagerConfig) 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"` }
type Signer ¶
type Signer interface { // Sign signs provided payload and returns encoded string sum. Sign(payload []byte) string Verify(payload []byte, hash string) bool }
Signer signs provided payloads.
type TokenSecretKey ¶
Click to show internal directories.
Click to hide internal directories.