Documentation
¶
Index ¶
- Constants
- type BaseConfig
- type BlockchainConfig
- type Config
- type ConsensusConfig
- type MempoolConfig
- type P2PConfig
- type RESTConfig
- type RPCConfig
- type ServerContext
- func (ctx *ServerContext) GetConfigFileName() string
- func (ctx *ServerContext) GetDefaultBaseConfig() BaseConfig
- func (ctx *ServerContext) GetDefaultBlockchainConfig() *BlockchainConfig
- func (ctx *ServerContext) GetDefaultConfig() interface{}
- func (ctx *ServerContext) GetDefaultConsensusConfig() *ConsensusConfig
- func (ctx *ServerContext) GetDefaultMempoolConfig() *MempoolConfig
- func (ctx *ServerContext) GetDefaultP2PConfig() *P2PConfig
- func (ctx *ServerContext) GetDefaultRESTConfig() *RESTConfig
- func (ctx *ServerContext) GetDefaultRPCConfig() *RPCConfig
- func (ctx *ServerContext) GetHomePath() string
- func (ctx *ServerContext) GetTemplate() string
Constants ¶
View Source
const (
EnvironmentPrefix = "AG"
)
Config should be read-only in outer world, but golang doesn't have any simple solution for that. A Developer MUST NOT modify config value in caller code.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseConfig ¶
type BaseConfig struct {
DataDir string `mapstructure:"datadir" description:"Directory to store datafiles"`
DbType string `mapstructure:"dbtype" description:"db implementation to store data"`
EnableProfile bool `mapstructure:"enableprofile" description:"enable profiling"`
ProfilePort int `mapstructure:"profileport" description:"profiling port (default:6060)"`
EnableRest bool `mapstructure:"enablerest" description:"enable rest port for testing"`
EnableTestmode bool `mapstructure:"enabletestmode" description:"enable unsafe test mode"`
}
BaseConfig defines base configurations for aergo server
type BlockchainConfig ¶
type BlockchainConfig struct {
MaxBlockSize uint32 `mapstructure:"maxblocksize" description:"maximum block size in bytes"`
CoinbaseAccount string `mapstructure:"coinbaseaccount" description:"wallet address for coinbase"`
MaxAnchorCount int `mapstructure:"maxanchorcount" description:"maximun anchor count for sync"`
}
BlockchainConfig defines configurations for blockchain service
type Config ¶
type Config struct {
BaseConfig `mapstructure:",squash"`
RPC *RPCConfig `mapstructure:"rpc"`
REST *RESTConfig `mapstructure:"rest"`
P2P *P2PConfig `mapstructure:"p2p"`
Blockchain *BlockchainConfig `mapstructure:"blockchain"`
Mempool *MempoolConfig `mapstructure:"mempool"`
Consensus *ConsensusConfig `mapstructure:"consensus"`
}
Config defines configurations of each services
type ConsensusConfig ¶
type ConsensusConfig struct {
EnableBp bool `mapstructure:"enablebp" description:"enable block production"`
EnableDpos bool `mapstructure:"enabledpos" description:"enable DPoS consensus"`
BlockInterval int64 `mapstructure:"blockinterval" description:"block production interval (sec)"`
DposBpNumber uint16 `mapstructure:"dposbps" description:"the number of DPoS block producers"`
BpIds []string `mapstructure:"bpids" description:"the IDs of the block producers"`
}
ConsensusConfig defines configurations for consensus service
type MempoolConfig ¶
type MempoolConfig struct {
ShowMetrics bool `mapstructure:"showmetrics" description:"show mempool metric periodically"`
VerifierNumber int `mapstructure:"verifiers" description:"number of concurrent verifier"`
DumpFilePath string `mapstructure:"dumpfilepath" description:"file path for recording mempool at process termintation"`
}
MempoolConfig defines configurations for mempool service
type P2PConfig ¶
type P2PConfig struct {
// N2N (peer-to-peer) network
NetProtocolAddr string `` /* 130-byte string literal not displayed */
NetProtocolPort int `mapstructure:"netprotocolport" description:"N2N network protocol port"`
NPEnableTLS bool `mapstructure:"nptls" description:"Enable TLS on N2N network"`
NPCert string `mapstructure:"npcert" description:"Certificate file for N2N network"`
NPKey string `mapstructure:"npkey" description:"Private Key file for N2N network"`
NPAddPeers []string `mapstructure:"npaddpeers" description:"Add peers to connect with at startup"`
NPMaxPeers int `mapstructure:"npmaxpeers" description:"Maximum number of remote peers to keep"`
NPPeerPool int `mapstructure:"nppeerpool" description:"Max peer pool size"`
}
P2PConfig defines configurations for p2p service
type RESTConfig ¶
type RESTConfig struct {
RestPort int `mapstructure:"restport" description:"Rest port(default:8080)"`
}
RESTConfig defines configurations for rest server
type RPCConfig ¶
type RPCConfig struct {
// RPC and REST
NetServiceAddr string `mapstructure:"netserviceaddr" description:"RPC service address"`
NetServicePort int `mapstructure:"netserviceport" description:"RPC service port"`
// RPC API with TLS
NSEnableTLS bool `mapstructure:"nstls" description:"Enable TLS on RPC or REST API"`
NSCert string `mapstructure:"nscert" description:"Certificate file for RPC or REST API"`
NSKey string `mapstructure:"nskey" description:"Private Key file for RPC or REST API"`
NSAllowCORS bool `mapstructure:"nsallowcors" description:"Allow CORS to RPC or REST API"`
}
RPCConfig defines configurations for rpc service
type ServerContext ¶
type ServerContext struct {
config.BaseContext
}
func NewServerContext ¶
func NewServerContext(homePath string, configFilePath string) *ServerContext
func (*ServerContext) GetConfigFileName ¶
func (ctx *ServerContext) GetConfigFileName() string
func (*ServerContext) GetDefaultBaseConfig ¶
func (ctx *ServerContext) GetDefaultBaseConfig() BaseConfig
func (*ServerContext) GetDefaultBlockchainConfig ¶
func (ctx *ServerContext) GetDefaultBlockchainConfig() *BlockchainConfig
func (*ServerContext) GetDefaultConfig ¶
func (ctx *ServerContext) GetDefaultConfig() interface{}
func (*ServerContext) GetDefaultConsensusConfig ¶
func (ctx *ServerContext) GetDefaultConsensusConfig() *ConsensusConfig
func (*ServerContext) GetDefaultMempoolConfig ¶
func (ctx *ServerContext) GetDefaultMempoolConfig() *MempoolConfig
func (*ServerContext) GetDefaultP2PConfig ¶
func (ctx *ServerContext) GetDefaultP2PConfig() *P2PConfig
func (*ServerContext) GetDefaultRESTConfig ¶
func (ctx *ServerContext) GetDefaultRESTConfig() *RESTConfig
func (*ServerContext) GetDefaultRPCConfig ¶
func (ctx *ServerContext) GetDefaultRPCConfig() *RPCConfig
func (*ServerContext) GetHomePath ¶
func (ctx *ServerContext) GetHomePath() string
func (*ServerContext) GetTemplate ¶
func (ctx *ServerContext) GetTemplate() string
Click to show internal directories.
Click to hide internal directories.