Documentation
¶
Index ¶
Constants ¶
const ( // StateFile is the full file name of the file that persists the validator's // last state. StateFile = "signctrl_state.json" // PermStateFile determines the default file permissions for the // signctrl_state.json file. PermStateFile = os.FileMode(0644) )
const ( // PermConfigDir determines the default file permissions for the configuration // directory. PermConfigDir = os.FileMode(0744) // PermConfigToml determines the default file permissions for the configuration // file. PermConfigToml = os.FileMode(0644) )
const (
// File is the full file name of the configuration file.
File = "config.toml"
)
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create writes configuration templates to the configuration file at the specified configuration directory. The base and privval sections are created by default.
func Dir ¶
func Dir() string
Dir returns the configuration directory in use. It is always set in the following order:
1) Custom environment variable $SIGNCTRL_CONFIG_DIR 2) $HOME/.signctrl 3) Current working directory
If one is not set, the directory falls back to the next one.
func GetRetryDialTime ¶
GetRetryDialTime converts the string representation of RetryDialAfter into time.Duration and returns it.
func StateFilePath ¶
StateFilePath returns the absolute path to the signctrl_state.json file.
Types ¶
type Base ¶
type Base struct {
// LogLevel determines the minimum log level for SignCTRL logs.
// Can be DEBUG, INFO, WARN or ERR.
LogLevel string `mapstructure:"log_level"`
// SetSize determines the number of validators in the SignCTRL set.
SetSize int `mapstructure:"set_size"`
// Threshold determines the threshold value of missed blocks in a row that
// triggers a rank update in the SignCTRL set.
Threshold int `mapstructure:"threshold"`
// StartRank determines the validator's rank on startup and therefore whether it
// has permission to sign votes/proposals or not.
StartRank int `mapstructure:"start_rank"`
// ValidatorListenAddress is the TCP socket address the validator listens on for
// an external PrivValidator process. SignCTRL dials this address to establish a
// connection with the validator.
ValidatorListenAddress string `mapstructure:"validator_laddr"`
// ValidatorListenAddressRPC is the TCP socket address the validator's RPC server
// listens on.
ValidatorListenAddressRPC string `mapstructure:"validator_laddr_rpc"`
// RetryDialAfter is the time after which SignCTRL assumes it lost connection to
// the validator and retries dialing it.
RetryDialAfter string `mapstructure:"retry_dial_after"`
}
Base defines the base configuration parameters for SignCTRL.
type Config ¶
type Config struct {
// Base defines the [base] section of the configuration file.
Base Base `mapstructure:"base"`
// Privval defines the [privval] section of the configuration file.
Privval PrivValidator `mapstructure:"privval"`
}
Config defines the structure of SignCTRL's configuration file.
type PrivValidator ¶
type PrivValidator struct {
// ChainID is the chain that the validator validates for.
ChainID string `mapstructure:"chain_id"`
}
PrivValidator defines the types of private validators that sign incoming sign requests.
type Section ¶
type Section uint8
Section is a custom type for specific sections in the configuration file.
type State ¶
State defines the contents of the signctrl_state.json file.
func LoadOrGenState ¶
LoadOrGenState loads the contents of the signctrl_state.json file and returns them if it exists, or generetas a new one.