Documentation ¶
Index ¶
Constants ¶
const ( // MinerNode defines the role of MultiVAC. MinerNode = iota // StorageNode defines the role of MultiVAC. StorageNode )
const ( AppMajor uint = 0 AppMinor uint = 2 AppPatch uint = 0 )
These constants define the application version and follow the semantic versioning 2.0.0 spec (http://semver.org/).
const ( // DefaultConnectTimeout defines the default time of timeout. DefaultConnectTimeout = time.Second * 30 )
Variables ¶
var (
StartNet int32
)
A holder for global configuration.
Functions ¶
func ActiveNetParams ¶
func ActiveNetParams() *netParams
ActiveNetParams returns a pointer to the parameters specific to the currently active bitcoin network.
func LoadConfig ¶
LoadConfig initializes and parses the Config using a Config file and command line options.
The configuration proceeds as follows:
- Start with a default Config with sane settings
- Pre-parse the command line to check for an alternative Config file
- Load configuration file overwriting defaults with any specified options
- Parse CLI options and overwrite/add any specified options
The above results in btcd functioning properly without any Config settings while still allowing the user to override settings with Config files and command line options. Command line options always take precedence.
func NormalizeAddress ¶
NormalizeAddress returns addr with the passed default port appended if there is not already a port specified.
func Version ¶
func Version() string
Version returns the application version as a properly formed string per the semantic versioning 2.0.0 spec (http://semver.org/).
Types ¶
type Config ¶
type Config struct { ShowVersion bool //`short:"V" long:"version" description:"Display version information and exit"` ConfigFile string //`short:"C" long:"configfile" description:"Path to configuration file"` DataDir string //`short:"b" long:"datadir" description:"Directory to store data"` LogDir string //`long:"logdir" description:"Directory to log output."` AddPeers []string //`short:"a" long:"addpeer" description:"Add a peer to connect with at startup"` ConnectPeers []string //`long:"connect" description:"Connect only to the specified peers at startup"` DisableListen bool //`long:"nolisten" description:"Disable listening for incoming connections -- NOTE: Listening is automatically disabled if the --connect or --proxy options are used without also specifying listen interfaces via --listen"` Listeners []string `` /* 127-byte string literal not displayed */ MonitorListeners []string //`long:"monitorlisten" description:"Add an interface/port to listen monitoring scrap"` MaxPeers int //`long:"maxpeers" description:"Max number of inbound and outbound peers"` MinShardPeers int32 //`long:"minshardpeers" description:"Min number of shard peers"` DisableBanning bool //`long:"nobanning" description:"Disable banning of misbehaving peers"` BanDuration time.Duration //`long:"banduration" description:"How long to ban misbehaving peers. Valid time units are {s, m, h}. Minimum 1 second"` BanThreshold uint32 //`long:"banthreshold" description:"Maximum allowed ban score before disconnecting and banning misbehaving peers."` Whitelists []string //`long:"whitelist" description:"Add an IP network or IP that will not be banned. (eg. 192.168.1.0/24 or ::1)"` RPCUser string //`short:"u" long:"rpcuser" description:"Username for RPC connections"` RPCPass string //`short:"P" long:"rpcpass" default-mask:"-" description:"Password for RPC connections"` RPCLimitUser string //`long:"rpclimituser" description:"Username for limited RPC connections"` RPCLimitPass string //`long:"rpclimitpass" default-mask:"-" description:"Password for limited RPC connections"` RPCListeners []string //`long:"rpclisten" description:"Add an interface/port to listen for RPC connections (default port: 8334, testnet: 18334)"` RPCCert string //`long:"rpccert" description:"File containing the certificate file"` RPCKey string //`long:"rpckey" description:"File containing the certificate key"` RPCMaxClients int //`long:"rpcmaxclients" description:"Max number of RPC clients for standard connections"` RPCMaxWebsockets int //`long:"rpcmaxwebsockets" description:"Max number of RPC websocket connections"` RPCMaxConcurrentReqs int //`long:"rpcmaxconcurrentreqs" description:"Max number of concurrent RPC requests that may be processed concurrently"` RPCQuirks bool //`long:"rpcquirks" description:"Mirror some JSON-RPC quirks of Bitcoin Core -- NOTE: Discouraged unless interoperability issues need to be worked around"` DisableRPC bool //`long:"norpc" description:"Disable built-in RPC server -- NOTE: The RPC server is disabled by default if no rpcuser/rpcpass or rpclimituser/rpclimitpass is specified"` DisableTLS bool //`long:"notls" description:"Disable TLS for the RPC server -- NOTE: This is only allowed if the RPC server is bound to localhost"` DisableDNSSeed bool //`long:"nodnsseed" description:"Disable DNS seeding for peers"` RunAsDNSSeed bool //`long:"runasdnsseed" description:"Run as DNS seeding, this will disable load peers and dns seeding for current node"` EnableRelayMessage bool //`long:"enablerelay" description:"Enable relay message in network, default false"` ExternalIPs []string //`long:"externalip" description:"Add an ip to the list of local addresses we claim to listen on to peers"` Proxy string //`long:"proxy" description:"Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)"` ProxyUser string //`long:"proxyuser" description:"Username for proxy server"` ProxyPass string //`long:"proxypass" default-mask:"-" description:"Password for proxy server"` OnionProxy string //`long:"onion" description:"Connect to tor hidden services via SOCKS5 proxy (eg. 127.0.0.1:9050)"` OnionProxyUser string //`long:"onionuser" description:"Username for onion proxy server"` OnionProxyPass string //`long:"onionpass" default-mask:"-" description:"Password for onion proxy server"` NoOnion bool //`long:"noonion" description:"Disable connecting to tor hidden services"` TorIsolation bool //`long:"torisolation" description:"Enable Tor stream isolation by randomizing user credentials for each connection."` TestNet3 bool //`long:"testnet" description:"Use the test network"` RegressionTest bool //`long:"regtest" description:"Use the regression test network"` SimNet bool //`long:"simnet" description:"Use the simulation test network"` StorageNode bool //`long:"storagenode" description:"Run as a standalone storage node"` AddCheckpoints []string //`long:"addcheckpoint" description:"Add a custom checkpoint. Format: '<height>:<hash>'"` DisableCheckpoints bool //`long:"nocheckpoints" description:"Disable built-in checkpoints. Don't do this unless you know what you're doing."` DbType string //`long:"dbtype" description:"Database backend to use for the Block Chain"` Profile string //`long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"` CPUProfile string //`long:"cpuprofile" description:"Write CPU profile to the specified file"` DebugLevel string //`short:"d" long:"debuglevel" description:"Logging level for all subsystems {trace, debug, info, warn, error, critical} -- You may also specify <subsystem>=<level>,<subsystem2>=<level>,... to set the log level for individual subsystems -- Use show to list available subsystems"` Upnp bool //`long:"upnp" description:"Use UPnP to map our listening port outside of NAT"` MinRelayTxFee float64 //`long:"minrelaytxfee" description:"The minimum transaction fee in BTC/kB to be considered a non-zero fee."` FreeTxRelayLimit float64 //`long:"limitfreerelay" description:"Limit relay of transactions with no transaction fee to the given amount in thousands of bytes per minute"` NoRelayPriority bool //`long:"norelaypriority" description:"Do not require free or low-fee transactions to have high priority for relaying"` MaxOrphanTxs int //`long:"maxorphantx" description:"Max number of orphan transactions to keep in memory"` Generate bool //`long:"generate" description:"Generate (mine) bitcoins using the CPU"` MiningAddrs []string //`long:"miningaddr" description:"Add the specified payment address to the list of addresses to use for generated blocks -- At least one address is required if the generate option is set"` BlockMinSize uint32 //`long:"blockminsize" description:"Mininum block size in bytes to be used when creating a block"` BlockMaxSize uint32 //`long:"blockmaxsize" description:"Maximum block size in bytes to be used when creating a block"` BlockMinWeight uint32 //`long:"blockminweight" description:"Mininum block weight to be used when creating a block"` BlockMaxWeight uint32 // `long:"blockmaxweight" description:"Maximum block weight to be used when creating a block"` BlockPrioritySize uint32 //`long:"blockprioritysize" description:"Size in bytes for high-priority/low-fee transactions when creating a block"` UserAgentComments []string //`long:"uacomment" description:"Comment to add to the user agent -- See BIP 14 for more information."` NoPeerBloomFilters bool //`long:"nopeerbloomfilters" description:"Disable bloom filtering support"` NoCFilters bool //`long:"nocfilters" description:"Disable committed filtering (CF) support"` DropCfIndex bool //`long:"dropcfindex" description:"Deletes the index used for committed filtering (CF) support from the database on start up and then exits."` SigCacheMaxSize uint //`long:"sigcachemaxsize" description:"The maximum number of entries in the signature verification cache"` BlocksOnly bool //`long:"blocksonly" description:"Do not accept transactions from remote peers."` TxIndex bool //`long:"txindex" description:"Maintain a full hash-based transaction index which makes all transactions available via the getrawtransaction RPC"` DropTxIndex bool //`long:"droptxindex" description:"Deletes the hash-based transaction index from the database on start up and then exits."` AddrIndex bool //`long:"addrindex" description:"Maintain a full address-based transaction index which makes the searchrawtransactions RPC available"` DropAddrIndex bool //`long:"dropaddrindex" description:"Deletes the address-based transaction index from the database on start up and then exits."` RelayNonStd bool //`long:"relaynonstd" description:"Relay non-standard transactions regardless of the default settings for the active network."` RejectNonStd bool //`long:"rejectnonstd" description:"Reject non-standard transactions regardless of the default settings for the active network."` VoteThreshold int //`long:"votethreshold" description:"The vote threshold for consensus algorithm"` DummySortitionor bool //`long:"dummysort" description:"Use dummy sortitionor which will always return true"` IntegrationTest bool //`long:"integtest" description:"Whether in integration test mode"` IsSharded bool //`long:"sharded" description:"Whether to enable sharding"` Shards []uint32 //`long:"shard" description:"Used by storage node only, specifies which shard this storage node is going to serve. Ignored by other type of nodes."` ExpNumShard int //`long:"expnumshard" description:"Expected number of shards a node can hold. If unspecified, it will be the maximum number of shards."` LeaderRate int //`long:"leaderrate" description:"Of leaderRate number of Leaders, only one is expected to be leader."` TimeForPeerDiscovery int //`long:"timeforpeerdiscovery" description:"Wait a while for peer discovery and sync."` Restart bool //`long:"restart" description:"whether restart mode ."` IsOneOfFirstMiners bool //`long:"isoneoffirstminers" description:"Whether the server is the first batch of miners."` RewardAddr string //`long:"rewardaddr" description:"Provide a reward address to make transactions."` Sk string `long:"sk" description:"the private for the miner."` UpdateWatchURL string //`long:"updatewatchurl" description:"The URL for polling new version update."` UpdateIntervalSec int //`long:"updateintervalsec" description:"The polling interval for update in seconds."` Lookup func(string) ([]net.IP, error) Pk string Oniondial func(string, string, time.Duration) (net.Conn, error) Dial func(string, string, time.Duration) (net.Conn, error) // contains filtered or unexported fields }
Config defines the configuration options for btcd.
See loadConfig for details on the configuration load process.
func GlobalConfig ¶
func GlobalConfig() *Config
GlobalConfig returns a global configuration for this node.
type NodeType ¶
type NodeType int
NodeType defines which roles in the project,eg:miner or storage.
func GetNodeType ¶
func GetNodeType() NodeType
GetNodeType returns the type of this MultiVAC node instance. Currently only supports miner type and storage node type.
func ParseNodeType ¶
ParseNodeType returns the NodeType from isStorageNode bool.