bootnode

package
v1.10.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2024 License: LGPL-3.0 Imports: 10 Imported by: 0

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

View Source
const (
	Mainnet   = "mainnet"
	Testnet   = "testnet"
	Pangaea   = "pangaea"
	Partner   = "partner"
	Stressnet = "stressnet"
	Devnet    = "devnet"
	Localnet  = "localnet"
)

Constants for NetworkType TODO: replace this with iota. Leave the string parsing in command line

Variables

This section is empty.

Functions

func GetPeerID

func GetPeerID() peer.ID

GetPeerID returns the peer ID of the node

func GetVersion

func GetVersion() string

GetVersion return the version of the node binary

func SetDefaultRole

func SetDefaultRole(r Role)

SetDefaultRole ..

func SetNetworkType

func SetNetworkType(networkType NetworkType)

SetNetworkType set the networkType

func SetPeerID

func SetPeerID(pid peer.ID)

SetPeerID set the peer ID of the node

func SetVersion

func SetVersion(ver string)

SetVersion set the version of the node binary

Types

type BootNodeConfig

type BootNodeConfig struct {
	Version string
	General GeneralConfig
	P2P     P2pConfig
	HTTP    HttpConfig
	WS      WsConfig
	RPCOpt  RpcOptConfig
	Pprof   PprofConfig
	Log     LogConfig
	Sys     *SysConfig `toml:",omitempty"`
}

BootNodeConfig contains all the configs user can set for running Intelchain binary. Served as the bridge from user set flags to internal node configs. Also user can persist this structure to a toml file to avoid inputting all arguments.

func (BootNodeConfig) ToRPCServerConfig

func (bnc BootNodeConfig) ToRPCServerConfig() nodeconfig.RPCServerConfig

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
	DebugMode bool            // log every single process and error to help to debug the syncing issues
	NtpServer 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 (*ConfigType) GetNetworkType

func (conf *ConfigType) GetNetworkType() NetworkType

GetNetworkType gets the networkType

func (*ConfigType) GetShardID

func (conf *ConfigType) GetShardID() uint32

GetShardID returns the shardID.

func (*ConfigType) Role

func (conf *ConfigType) Role() Role

Role returns the role

func (*ConfigType) SetRole

func (conf *ConfigType) SetRole(r Role)

SetRole set the role

func (*ConfigType) SetShardID

func (conf *ConfigType) SetShardID(s uint32)

SetShardID set the ShardID

func (*ConfigType) String

func (conf *ConfigType) String() string

type GeneralConfig

type GeneralConfig struct {
	NodeType    string
	ShardID     int
	TraceEnable bool
}

type HttpConfig

type HttpConfig struct {
	Enabled      bool
	IP           string
	Port         int
	AuthPort     int
	ReadTimeout  string
	WriteTimeout string
	IdleTimeout  string
}

type LogConfig

type LogConfig struct {
	Console       bool
	Folder        string
	FileName      string
	RotateSize    int
	RotateCount   int
	RotateMaxAge  int
	Verbosity     int
	VerbosePrints LogVerbosePrints
	Context       *LogContext `toml:",omitempty"`
}

type LogContext

type LogContext struct {
	IP   string
	Port int
}

type LogVerbosePrints

type LogVerbosePrints struct {
	Config bool
}

func FlagSliceToLogVerbosePrints

func FlagSliceToLogVerbosePrints(verbosePrintsFlagSlice []string) LogVerbosePrints

type NetworkType

type NetworkType string

NetworkType describes the type of Intelchain network

func (NetworkType) ChainConfig

func (t NetworkType) ChainConfig() params.ChainConfig

ChainConfig returns the chain configuration for the network type.

func (NetworkType) String

func (n NetworkType) String() string

type P2pConfig

type P2pConfig struct {
	Port                 int
	IP                   string
	KeyFile              string
	DHTDataStore         *string `toml:",omitempty"`
	DiscConcurrency      int     // Discovery Concurrency value
	MaxConnsPerIP        int
	DisablePrivateIPScan bool
	MaxPeers             int64
	// In order to disable Connection Manager, it only needs to
	// set both the high and low watermarks to zero. In this way,
	// using Connection Manager will be an optional feature.
	ConnManagerLowWatermark  int
	ConnManagerHighWatermark int
	WaitForEachPeerToConnect bool
	// to disable p2p security (tls and noise)
	NoTransportSecurity bool
	// enable p2p NAT. NAT Manager takes care of setting NAT port mappings, and discovering external addresses
	NAT bool
	// custom user agent; explicitly set the user-agent, so we can differentiate from other Go libp2p users
	UserAgent string
	// p2p dial timeout
	DialTimeout time.Duration
	// P2P multiplexer type, should be comma separated (mplex, Yamux)
	Muxer string
	// No relay services, direct connections between peers only
	NoRelay bool
}

type PprofConfig

type PprofConfig struct {
	Enabled            bool
	ListenAddr         string
	Folder             string
	ProfileNames       []string
	ProfileIntervals   []int
	ProfileDebugValues []int
}

type PrometheusConfig

type PrometheusConfig struct {
	Enabled    bool
	IP         string
	Port       int
	EnablePush bool
	Gateway    string
}

type RPCServerConfig

type RPCServerConfig struct {
	HTTPEnabled bool
	HTTPIp      string
	HTTPPort    int

	HTTPTimeoutRead  time.Duration
	HTTPTimeoutWrite time.Duration
	HTTPTimeoutIdle  time.Duration

	WSEnabled bool
	WSIp      string
	WSPort    int

	DebugEnabled bool

	NetworkRPCsEnabled bool

	RpcFilterFile string

	RateLimiterEnabled bool
	RequestsPerSecond  int
}

RPCServerConfig is the config for rpc listen addresses

type Role

type Role byte

Role defines a role of a node.

const (
	Unknown Role = iota
	BootNode
)

All constants for different node roles.

func (Role) String

func (role Role) String() string

type RpcOptConfig

type RpcOptConfig struct {
	DebugEnabled      bool   // Enables PrivateDebugService APIs, including the EVM tracer
	EthRPCsEnabled    bool   // Expose Eth RPCs
	LegacyRPCsEnabled bool   // Expose Legacy RPCs
	RpcFilterFile     string // Define filters to enable/disable RPC exposure
	RateLimterEnabled bool   // Enable Rate limiter for RPC
	RequestsPerSecond int    // for RPC rate limiter
}

type SysConfig

type SysConfig struct {
	NtpServer string
}

type WsConfig

type WsConfig struct {
	Enabled  bool
	IP       string
	Port     int
	AuthPort int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL