Documentation
¶
Index ¶
- Constants
- Variables
- func AppDataDir(appName string, roaming bool) string
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func CleanAndExpandPath(path string) string
- func GenerateNetworkKeypair() (crypto.PrivKey, crypto.PubKey, error)
- func HasNetworkKey(ds Datastore) (bool, error)
- func LoadNetworkKey(ds Datastore) (crypto.PrivKey, error)
- func MustAsset(name string) []byte
- func PutNetworkKey(ds Datastore, key crypto.PrivKey) error
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func TstAppDataDir(goos, appName string, roaming bool) string
- func UpdateLogger()
- func VersionString() string
- type Config
- type Datastore
- type Policy
- type RPCOptions
- type TxnDataStore
Constants ¶
const ( DefaultLogFilename = "ilxd.log" DefaultFeePerKilobyte = 10000 DefaultMinimumStake = 1000000 DefaultMaxMessageSize = 1 << 23 // 8 MiB DefaultSoftLimit = 1 << 20 // 1 MiB DefaultMaxBanscore = 100 DefaultBanDuration = time.Hour * 24 )
const ( // NetworkKeyDatastoreKey is the datastore key for the network (libp2p) private key. NetworkKeyDatastoreKey = "/ilxd/libp2pkey/" // ValidatorDatastoreKeyPrefix is the datastore key prefix for the validators. ValidatorDatastoreKeyPrefix = "/ilxd/validator/" // ValidatorSetLastFlushHeight is the datastore key for last flush height of the validator set. ValidatorSetLastFlushHeight = "/ilxd/validatorsetlastflushheight/" // ValidatorSetConsistencyStatusKey is the datastore key for the validator set flush state. ValidatorSetConsistencyStatusKey = "/ilxd/validatorsetconsistencystatus/" // AccumulatorConsistencyStatusKey is the datastore key for the accumulator flush state. AccumulatorConsistencyStatusKey = "/ilxd/accumulatorconsistencystatus/" // AccumulatorLastFlushHeight is the datastore key for last flush height of the accumulator. AccumulatorLastFlushHeight = "/ilxd/accumulatorlastflushheight/" // BlockByHeightKeyPrefix is the datastore key prefix for mapping block heights to block IDs. BlockByHeightKeyPrefix = "/ilxd/blockbyheight/" // BlockKeyPrefix is the datastore key prefix for storing block headers by blockID. BlockKeyPrefix = "/ilxd/block/" // BlockTxsKeyPrefix is the datastore key prefix mapping a block ID to a list of txids. BlockTxsKeyPrefix = "/ilxd/blocktxs/" // BlockIndexStateKey is the datastore key used to store the block index best state. BlockIndexStateKey = "/ilxd/blockindex/" // NullifierKeyPrefix is the datastore key prefix for storing nullifiers in the nullifier set. NullifierKeyPrefix = "/ilxd/nullifier/" // TxoRootKeyPrefix is the datastore key prefix for storing a txo root in the database. TxoRootKeyPrefix = "/ilxd/txoroot/" // TreasuryBalanceKey is the datastire key for storing the balance of the treasury in the database. TreasuryBalanceKey = "/ilxd/treasury/" // AccumulatorStateKey is the datastore key for storing the accumulator state. AccumulatorStateKey = "/ilxd/accumulator/" // AccumulatorCheckpointKey is the datastore key for storing accumulator checkpoints. AccumulatorCheckpointKey = "/ilxd/accumulatorcheckpoint/" // CoinSupplyKey is the datastore key for storing the current supply of coins. CoinSupplyKey = "/ilxd/coinsupply/" // IndexerHeightKeyPrefix is the datastore key prefix for mapping indexers to sync heights. IndexerHeightKeyPrefix = "/ilxd/indexerheight/" // IndexKeyPrefix is the datastore key used by each indexer. This must be extended to use. IndexKeyPrefix = "/ilxd/index/" // ConnGaterKeyPrefix is the datastore namespace key used by the conngater. ConnGaterKeyPrefix = "/ilxd/conngater/" // AutostakeDatastoreKey is the datastore key used to store the autostake bool. AutostakeDatastoreKey = "/ilxd/autostake/" )
const ( AppMajor uint = 0 AppMinor uint = 0 AppPatch uint = 2 // AppPreRelease MUST only contain characters from semanticAlphabet // per the semantic versioning spec. AppPreRelease = "alpha" )
These constants define the application version and follow the semantic versioning 2.0.0 spec (http://semver.org/).
Variables ¶
var (
DefaultHomeDir = AppDataDir("ilxd", false)
)
Functions ¶
func AppDataDir ¶
AppDataDir returns an operating system specific directory to be used for storing application data for an application.
The appName parameter is the name of the application the data directory is being requested for. This function will prepend a period to the appName for POSIX style operating systems since that is standard practice. An empty appName or one with a single dot is treated as requesting the current directory so only "." will be returned. Further, the first character of appName will be made lowercase for POSIX style operating systems and uppercase for Mac and Windows since that is standard practice.
The roaming parameter only applies to Windows where it specifies the roaming application data profile (%APPDATA%) should be used instead of the local one (%LOCALAPPDATA%) that is used by default.
Example results:
dir := AppDataDir("myapp", false) POSIX (Linux/BSD): ~/.myapp Mac OS: $HOME/Library/Application Support/Myapp Windows: %LOCALAPPDATA%\Myapp Plan 9: $home/myapp
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func CleanAndExpandPath ¶
CleanAndExpandPath expands environment variables and leading ~ in the passed path, cleans the result, and returns it.
func HasNetworkKey ¶
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func TstAppDataDir ¶
TstAppDataDir makes the internal appDataDir function available to the test package.
func UpdateLogger ¶
func UpdateLogger()
func VersionString ¶
func VersionString() string
VersionString 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:"d" long:"datadir" description:"Directory to store data"` LogDir string `long:"logdir" description:"Directory to log output"` WalletDir string `long:"walletdir" description:"Directory to store wallet data"` LogLevel string `` /* 134-byte string literal not displayed */ EnableDebugLogging bool `long:"debug" description:"Enable libp2p debug logging to the terminal"` SeedAddrs []string `long:"seedaddr" description:"Override the default seed addresses with the provided values"` ListenAddrs []string `long:"listenaddr" description:"Override the default listen addresses with the provided values"` Testnet bool `short:"t" long:"testnet" description:"Use the test network"` Alphanet bool `long:"alpha" description:"Use the alpha network"` Regtest bool `short:"r" long:"regtest" description:"Use regression testing mode"` RegtestVal bool `long:"regtestval" description:"Set self as the regtest genesis validator. This can only be done on first startup."` DisableNATPortMap bool `long:"noupnp" description:"Disable use of upnp"` UserAgent string `long:"useragent" description:"A custom user agent to advertise to the network"` NoTxIndex bool `long:"notxindex" description:"Disable the transaction index"` DropTxIndex bool `long:"droptxindex" description:"Delete the tx index from the database"` MaxBanscore uint32 `long:"maxbanscore" description:"The maximum ban score a peer is allowed to have before getting banned" default:"100"` BanDuration time.Duration `long:"banduration" description:"The duration for which banned peers are banned for" default:"24h"` WalletSeed string `long:"walletseed" description:"A mnemonic seed to initialize the node with. This can only be used on first startup."` CoinbaseAddress string `` /* 171-byte string literal not displayed */ NetworkKey string `long:"networkkey" description:"A network key to use for this node. This will override the node's peer ID."` Policy Policy `group:"Policy"` RPCOpts RPCOptions `group:"RPC Options"` }
Config defines the configuration options for the node.
See LoadConfig for details on the configuration load process.
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 proper functionality 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.
type Datastore ¶
type Datastore interface { datastore.Datastore datastore.Batching datastore.PersistentDatastore datastore.TxnDatastore }
type Policy ¶
type Policy struct { MinFeePerKilobyte uint64 `` /* 129-byte string literal not displayed */ MinStake uint64 `long:"minstake" description:"The minimum stake required to accept a stake tx into the mempool or a generated block"` TreasuryWhitelist []string `long:"treasurywhitelist" description:"Allow these treasury txids into the mempool and generated blocks"` BlocksizeSoftLimit uint32 `long:"blocksizesoftlimit" description:"The maximum size block this node will generate"` MaxMessageSize int `` /* 178-byte string literal not displayed */ }
type RPCOptions ¶
type RPCOptions struct { RPCCert string `long:"rpccert" description:"A path to the SSL certificate to use with gRPC"` RPCKey string `long:"rpckey" description:"A path to the SSL key to use with gRPC"` ExternalIPs []string `` /* 138-byte string literal not displayed */ GrpcListener string `` /* 151-byte string literal not displayed */ GrpcAuthToken string `long:"grpcauthtoken" description:"Set a token here if you want to enable client authentication with gRPC."` DisableNodeService bool `` /* 145-byte string literal not displayed */ DisableWalletService bool `` /* 149-byte string literal not displayed */ }
type TxnDataStore ¶
type TxnDataStore interface { datastore.TxnDatastore }