Documentation ¶
Index ¶
- Constants
- type AccountConfig
- type BaseConfig
- type BlockchainConfig
- type Config
- type ConsensusConfig
- type MempoolConfig
- type MonitorConfig
- type P2PConfig
- type PolarisConfig
- type RESTConfig
- type RPCConfig
- type ServerContext
- func (ctx *ServerContext) GetConfigFileName() string
- func (ctx *ServerContext) GetDefaultAccountConfig() *AccountConfig
- 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) GetDefaultMonitorConfig() *MonitorConfig
- func (ctx *ServerContext) GetDefaultP2PConfig() *P2PConfig
- func (ctx *ServerContext) GetDefaultPolarisConfig() *PolarisConfig
- func (ctx *ServerContext) GetDefaultRESTConfig() *RESTConfig
- func (ctx *ServerContext) GetDefaultRPCConfig() *RPCConfig
- func (ctx *ServerContext) GetHomePath() string
- func (ctx *ServerContext) GetTemplate() string
Constants ¶
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 AccountConfig ¶ added in v0.9.0
type AccountConfig struct {
UnlockTimeout uint `mapstructure:"unlocktimeout" description:"lock automatically after timeout (sec)"`
}
Account defines configurations for account service
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"` Personal bool `mapstructure:"personal" description:"enable personal account service"` }
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"` VerifierCount int `mapstructure:"verifiercount" description:"maximun transaction verifier count"` }
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"` Polaris *PolarisConfig `mapstructure:"polaris"` Blockchain *BlockchainConfig `mapstructure:"blockchain"` Mempool *MempoolConfig `mapstructure:"mempool"` Consensus *ConsensusConfig `mapstructure:"consensus"` Monitor *MonitorConfig `mapstructure:"monitor"` Account *AccountConfig `mapstructure:"account"` }
Config defines configurations of each services
type ConsensusConfig ¶
type ConsensusConfig struct { EnableBp bool `mapstructure:"enablebp" description:"enable block production"` BlockInterval int64 `mapstructure:"blockinterval" description:"block production interval (sec)"` }
ConsensusConfig defines configurations for consensus service
type MempoolConfig ¶
type MempoolConfig struct { ShowMetrics bool `mapstructure:"showmetrics" description:"show mempool metric periodically"` EnableFadeout bool `mapstructure:"enablefadeout" description:"Enable transaction fadeout over timeout period"` FadeoutPeriod int `mapstructure:"fadeoutperiod" description:"time period for evict transactions(in hour)"` 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 MonitorConfig ¶ added in v0.8.1
type P2PConfig ¶
type P2PConfig struct { // N2N (peer-to-peer) network NetProtocolAddr string `` /* 139-byte string literal not displayed */ NetProtocolPort int `` /* 133-byte string literal not displayed */ NPBindAddr string `mapstructure:"npbindaddr" description:"N2N bind address. If it was set, it only accept connection to this addresse only"` NPBindPort int `` /* 161-byte string literal not displayed */ 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 to at startup"` NPHiddenPeers []string `mapstructure:"nphiddenpeers" description:"List of peerids which will not show to other peers"` NPDiscoverPeers bool `mapstructure:"npdiscoverpeers" description:"Whether to discover from polaris or other nodes and connects"` NPMaxPeers int `mapstructure:"npmaxpeers" description:"Maximum number of remote peers to keep"` NPPeerPool int `mapstructure:"nppeerpool" description:"Max peer pool size"` NPExposeSelf bool `mapstructure:"npexposeself" description:"Whether to request expose self to polaris and other connected node"` NPUsePolaris bool `mapstructure:"npusepolaris" description:"Whether to connect and get node list from polaris"` NPAddPolarises []string `mapstructure:"npaddpolarises" description:"Add addresses of polarises if default polaris is not sufficient"` }
P2PConfig defines configurations for p2p service
type PolarisConfig ¶ added in v0.9.0
type PolarisConfig struct { AllowPrivate bool `mapstructure:"allowprivate" description:"allow peer to have private address. for private network and test"` GenesisFile string `mapstructure:"genesisfile" description:"json file containing informations of genesisblock to which polaris refer "` }
PolarisConfig defines configuration for polaris server and client (i.e. polarisConnect)
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"` NetServiceTrace bool `mapstructure:"netservicetrace" description:"Trace RPC service"` // 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) GetDefaultAccountConfig ¶ added in v0.9.0
func (ctx *ServerContext) GetDefaultAccountConfig() *AccountConfig
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) GetDefaultMonitorConfig ¶ added in v0.8.1
func (ctx *ServerContext) GetDefaultMonitorConfig() *MonitorConfig
func (*ServerContext) GetDefaultP2PConfig ¶
func (ctx *ServerContext) GetDefaultP2PConfig() *P2PConfig
func (*ServerContext) GetDefaultPolarisConfig ¶ added in v0.9.0
func (ctx *ServerContext) GetDefaultPolarisConfig() *PolarisConfig
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