Documentation ¶
Overview ¶
Package nodeconfig includes all the configuration variables for a node. It is a global configuration for node and other services. It will be included in node module, and other modules.
Index ¶
- Constants
- func GetDefaultBootNodes(networkType NetworkType) []string
- func GetDefaultDNSPort(NetworkType) int
- func GetDefaultDNSZone(networkType NetworkType) string
- func GetPeerID() peer.ID
- func GetPrometheusHTTPPortFromBase(basePort int) int
- func GetRPCAuthHTTPPortFromBase(basePort int) int
- func GetRPCHTTPPortFromBase(basePort int) int
- func GetRosettaHTTPPortFromBase(basePort int) int
- func GetVersion() string
- func GetWSAuthPortFromBase(basePort int) int
- func GetWSPortFromBase(basePort int) int
- func SetDefaultRole(r Role)
- func SetNetworkType(networkType NetworkType)
- func SetPeerID(pid peer.ID)
- func SetShardingSchedule(schedule shardingconfig.Schedule)
- func SetVersion(ver string)
- type ActionType
- type ConfigType
- func (conf *ConfigType) ArchiveModes() map[uint32]bool
- func (conf *ConfigType) GetArchival() bool
- func (conf *ConfigType) GetBeaconGroupID() GroupID
- func (conf *ConfigType) GetClientGroupID() GroupID
- func (conf *ConfigType) GetNetworkType() NetworkType
- func (conf *ConfigType) GetShardGroupID() GroupID
- func (conf *ConfigType) GetShardID() uint32
- func (conf *ConfigType) Role() Role
- func (conf *ConfigType) SetArchival(bcArchival, archival bool)
- func (conf *ConfigType) SetBeaconGroupID(g GroupID)
- func (conf *ConfigType) SetClientGroupID(g GroupID)
- func (conf *ConfigType) SetRole(r Role)
- func (conf *ConfigType) SetShardGroupID(g GroupID)
- func (conf *ConfigType) SetShardID(s uint32)
- func (conf *ConfigType) SetShardingSchedule(schedule shardingconfig.Schedule)
- func (conf *ConfigType) ShardIDFromConsensusKey() (uint32, error)
- func (conf *ConfigType) ShardIDFromKey(key *bls_core.PublicKey) (uint32, error)
- func (conf *ConfigType) ShardingSchedule() shardingconfig.Schedule
- func (conf *ConfigType) String() string
- func (conf *ConfigType) ValidateConsensusKeysForSameShard(pubkeys multibls.PublicKeys, sID uint32) error
- type GroupAction
- type GroupID
- type NetworkType
- type RPCServerConfig
- type Role
- type RosettaServerConfig
- type ShardID
Constants ¶
const ( Mainnet = "mainnet" Testnet = "testnet" Devnet = "devnet" Stressnet = "stressnet" Localnet = "localnet" )
Constants for NetworkType TODO: replace this with iota. Leave the string parsing in command line
const ( Global = 0 MaxShards = 32 // maximum number of shards. It is also the maxium number of configs. )
Global is the index of the global node configuration
const ( // DefaultLocalListenIP is the IP used for local hosting DefaultLocalListenIP = "127.0.0.1" // DefaultPublicListenIP is the IP used for public hosting DefaultPublicListenIP = "0.0.0.0" // DefaultP2PPort is the key to be used for p2p communication DefaultP2PPort = 9000 // DefaultLegacyDNSPort is the default legacy DNS port. The actual port used is DNSPort - 3000. This is a // very bad design. Refactored to DefaultDNSPort DefaultLegacyDNSPort = 9000 // DefaultDNSPort is the default DNS port for both remote node and local server. DefaultDNSPort = 6000 // DefaultRPCPort is the default rpc port. The actual port used is 9000+500 DefaultRPCPort = 9500 // DefaultAuthRPCPort is the default rpc auth port. The actual port used is 9000+501 DefaultAuthRPCPort = 9501 // DefaultRosettaPort is the default rosetta port. The actual port used is 9000+700 DefaultRosettaPort = 9700 // DefaultWSPort is the default port for web socket endpoint. The actual port used is DefaultWSPort = 9800 // DefaultAuthWSPort is the default port for web socket auth endpoint. The actual port used is DefaultAuthWSPort = 9801 // DefaultPrometheusPort is the default prometheus port. The actual port used is 9000+900 DefaultPrometheusPort = 9900 // DefaultP2PConcurrency is the default P2P concurrency, 0 means is set the default value of P2P Discovery, the actual value is 10 DefaultP2PConcurrency = 0 DefaultMaxConnPerIP = 10 )
const (
// DefaultRateLimit for RPC, the number of requests per second
DefaultRPCRateLimit = 1000
)
Variables ¶
This section is empty.
Functions ¶
func GetDefaultBootNodes ¶
func GetDefaultBootNodes(networkType NetworkType) []string
GetDefaultBootNodes get the default bootnode with the given network type
func GetDefaultDNSPort ¶
func GetDefaultDNSPort(NetworkType) int
GetDefaultDNSPort get the default DNS port for the given network type
func GetDefaultDNSZone ¶
func GetDefaultDNSZone(networkType NetworkType) string
GetDefaultDNSZone get the default DNS zone with the given network type
func GetPrometheusHTTPPortFromBase ¶
GetPrometheusHTTPPortFromBase return the prometheus HTTP port from base port
func GetRPCAuthHTTPPortFromBase ¶
GetRPCAuthHTTPPortFromBase return the rpc HTTP port from base port
func GetRPCHTTPPortFromBase ¶
GetRPCHTTPPortFromBase return the rpc HTTP port from base port
func GetRosettaHTTPPortFromBase ¶
GetRosettaHTTPPortFromBase return the rosetta HTTP port from base port
func GetWSAuthPortFromBase ¶
GetWSAuthPortFromBase return the Websocket port from the base auth port
func GetWSPortFromBase ¶
GetWSPortFromBase return the Websocket port from the base port
func SetNetworkType ¶
func SetNetworkType(networkType NetworkType)
SetNetworkType set the networkType
func SetShardingSchedule ¶
func SetShardingSchedule(schedule shardingconfig.Schedule)
SetShardingSchedule sets the sharding schedule for all config instances.
Types ¶
type ActionType ¶
type ActionType uint
ActionType lists action on group
const ( ActionStart ActionType = iota ActionPause ActionResume ActionStop ActionUnknown )
Const of different Action type
func (ActionType) String ¶
func (a ActionType) String() string
type ConfigType ¶
type ConfigType struct { ShardID uint32 // ShardID of this node; TODO ek – revisit when resharding Port string // Port of the node. IP string // IP of the node. RPCServer RPCServerConfig // RPC server port and ip RosettaServer RosettaServerConfig // rosetta server port and ip IsOffline bool Downloader bool // Whether stream downloader is running; TODO: remove this after sync up NtpServer string StringRole string P2PPriKey p2p_crypto.PrivKey `json:"-"` ConsensusPriKey multibls.PrivateKeys `json:"-"` // Database directory DBDir string DNSZone string WebHooks struct { Hooks *webhooks.Hooks } TraceEnable bool // contains filtered or unexported fields }
ConfigType is the structure of all node related configuration variables
func GetDefaultConfig ¶
func GetDefaultConfig() *ConfigType
GetDefaultConfig returns default config.
func GetShardConfig ¶
func GetShardConfig(shardID uint32) *ConfigType
GetShardConfig return the shard's ConfigType variable
func (*ConfigType) ArchiveModes ¶
func (conf *ConfigType) ArchiveModes() map[uint32]bool
ArchiveModes return the map of the archive setting
func (*ConfigType) GetArchival ¶
func (conf *ConfigType) GetArchival() bool
GetArchival returns archival mode
func (*ConfigType) GetBeaconGroupID ¶
func (conf *ConfigType) GetBeaconGroupID() GroupID
GetBeaconGroupID returns the groupID for beacon group
func (*ConfigType) GetClientGroupID ¶
func (conf *ConfigType) GetClientGroupID() GroupID
GetClientGroupID returns the groupID for client group
func (*ConfigType) GetNetworkType ¶
func (conf *ConfigType) GetNetworkType() NetworkType
GetNetworkType gets the networkType
func (*ConfigType) GetShardGroupID ¶
func (conf *ConfigType) GetShardGroupID() GroupID
GetShardGroupID returns the groupID for shard group
func (*ConfigType) GetShardID ¶
func (conf *ConfigType) GetShardID() uint32
GetShardID returns the shardID.
func (*ConfigType) SetArchival ¶
func (conf *ConfigType) SetArchival(bcArchival, archival bool)
SetArchival set archival mode for beacon chain node, the archival variable will overrdie bcArchival as the shardID is the same
func (*ConfigType) SetBeaconGroupID ¶
func (conf *ConfigType) SetBeaconGroupID(g GroupID)
SetBeaconGroupID set the groupID for beacon group
func (*ConfigType) SetClientGroupID ¶
func (conf *ConfigType) SetClientGroupID(g GroupID)
SetClientGroupID set the groupID for client group
func (*ConfigType) SetShardGroupID ¶
func (conf *ConfigType) SetShardGroupID(g GroupID)
SetShardGroupID set the groupID for shard group
func (*ConfigType) SetShardID ¶
func (conf *ConfigType) SetShardID(s uint32)
SetShardID set the ShardID
func (*ConfigType) SetShardingSchedule ¶
func (conf *ConfigType) SetShardingSchedule(schedule shardingconfig.Schedule)
SetShardingSchedule sets the sharding schedule for this node config.
func (*ConfigType) ShardIDFromConsensusKey ¶
func (conf *ConfigType) ShardIDFromConsensusKey() (uint32, error)
ShardIDFromConsensusKey returns the shard ID statically determined from the consensus key.
func (*ConfigType) ShardIDFromKey ¶
func (conf *ConfigType) ShardIDFromKey(key *bls_core.PublicKey) (uint32, error)
ShardIDFromKey returns the shard ID statically determined from the input key
func (*ConfigType) ShardingSchedule ¶
func (conf *ConfigType) ShardingSchedule() shardingconfig.Schedule
ShardingSchedule returns the sharding schedule for this node config.
func (*ConfigType) String ¶
func (conf *ConfigType) String() string
func (*ConfigType) ValidateConsensusKeysForSameShard ¶
func (conf *ConfigType) ValidateConsensusKeysForSameShard(pubkeys multibls.PublicKeys, sID uint32) error
ValidateConsensusKeysForSameShard checks if all consensus public keys belong to the same shard
type GroupAction ¶
type GroupAction struct { Name GroupID Action ActionType }
GroupAction specify action on corresponding group
func (GroupAction) String ¶
func (g GroupAction) String() string
type GroupID ¶
type GroupID string
GroupID is a multicast group ID.
It is a binary string, conducive to layering and scoped generation using cryptographic hash.
Applications define their own group ID, without central allocation. A cryptographically secure random string of enough length – 32 bytes for example – may be used.
const ( GroupIDBeacon GroupID = "%s/0.0.1/node/beacon" GroupIDBeaconClient GroupID = "%s/0.0.1/client/beacon" GroupIDShardPrefix GroupID = "%s/0.0.1/node/shard/%s" GroupIDShardClientPrefix GroupID = "%s/0.0.1/client/shard/%s" GroupIDGlobal GroupID = "%s/0.0.1/node/global" GroupIDGlobalClient GroupID = "%s/0.0.1/node/global" GroupIDUnknown GroupID = "%s/B1acKh0lE" )
Const of group ID
func NewClientGroupIDByShardID ¶
NewClientGroupIDByShardID returns a new groupID for a shard's client
func NewGroupIDByShardID ¶
NewGroupIDByShardID returns a new groupID for a shard
type NetworkType ¶
type NetworkType string
NetworkType describes the type of Harmony network
func (NetworkType) ChainConfig ¶
func (t NetworkType) ChainConfig() params.ChainConfig
ChainConfig returns the chain configuration for the network type.
type RPCServerConfig ¶
type RPCServerConfig struct { HTTPEnabled bool HTTPIp string HTTPPort int HTTPAuthPort int WSEnabled bool WSIp string WSPort int WSAuthPort int DebugEnabled bool EthRPCsEnabled bool StakingRPCsEnabled bool LegacyRPCsEnabled bool RpcFilterFile string RateLimiterEnabled bool RequestsPerSecond int }
RPCServerConfig is the config for rpc listen addresses
type RosettaServerConfig ¶
RosettaServerConfig is the config for the rosetta server