Documentation ¶
Index ¶
Constants ¶
const ( //DefaultConnectTimeout is the default connection timeout when dialing DefaultConnectTimeout = time.Second * 30 //DefaultMaxRPCClients is the default max number of RPC clients DefaultMaxRPCClients = 128 //DefaultMaxOrphanTxSize is the default maximum size for an orphan transaction DefaultMaxOrphanTxSize = 100_000 )
Variables ¶
var ( // DefaultAppDir is the default home directory for kobrad. DefaultAppDir = util.AppDir("kobradag", false) )
var RunServiceCommand func(string) error
RunServiceCommand is only set to a real function on Windows. It is used to parse and execute service commands specified via the -s flag.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { *Flags Lookup func(string) ([]net.IP, error) Dial func(string, string, time.Duration) (net.Conn, error) MiningAddrs []util.Address MinRelayTxFee util.Amount Whitelists []*net.IPNet SubnetworkID *externalapi.DomainSubnetworkID // nil in full nodes }
Config defines the configuration options for kobrad.
See loadConfig for details on the configuration load process.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default kobrad configuration
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 kobrad 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.
type Flags ¶
type Flags struct { ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"` ConfigFile string `short:"C" long:"configfile" description:"Path to configuration file"` AppDir string `short:"b" long:"appdir" 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 `` /* 217-byte string literal not displayed */ Listeners []string `` /* 128-byte string literal not displayed */ TargetOutboundPeers int `long:"outpeers" description:"Target number of outbound peers"` MaxInboundPeers int `long:"maxinpeers" description:"Max number of inbound peers"` EnableBanning bool `long:"enablebanning" description:"Enable 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)"` RPCListeners []string `long:"rpclisten" description:"Add an interface/port to listen for RPC connections (default port: 25110, testnet: 16210)"` 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"` DisableRPC bool `long:"norpc" description:"Disable built-in RPC server"` SafeRPC bool `long:"saferpc" description:"Disable RPC commands which affect the state of the node"` DisableDNSSeed bool `long:"nodnsseed" description:"Disable DNS seeding for peers"` DNSSeed string `long:"dnsseed" description:"Override DNS seeds with specified hostname (Only 1 hostname allowed)"` GRPCSeed string `long:"grpcseed" description:"Hostname of gRPC server for seeding peers"` 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"` DbType string `long:"dbtype" description:"Database backend to use for the Block DAG"` Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"` LogLevel string `` /* 273-byte string literal not displayed */ 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 KODA/kB to be considered a non-zero fee."` MaxOrphanTxs uint64 `long:"maxorphantx" description:"Max number of orphan transactions to keep in memory"` BlockMaxMass uint64 `long:"blockmaxmass" description:"Maximum transaction mass to be used 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"` 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."` 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."` ResetDatabase bool `long:"reset-db" description:"Reset database before starting node. It's needed when switching between subnetworks."` MaxUTXOCacheSize uint64 `long:"maxutxocachesize" description:"Max size of loaded UTXO into ram from the disk in bytes"` UTXOIndex bool `long:"utxoindex" description:"Enable the UTXO index"` IsArchivalNode bool `` /* 141-byte string literal not displayed */ AllowSubmitBlockWhenNotSynced bool `` /* 166-byte string literal not displayed */ EnableSanityCheckPruningUTXOSet bool `` /* 151-byte string literal not displayed */ ProtocolVersion uint32 `long:"protocol-version" description:"Use non default p2p protocol version"` NetworkFlags ServiceOptions *ServiceOptions }
Flags defines the configuration options for kobrad.
See loadConfig for details on the configuration load process.
type NetworkFlags ¶
type NetworkFlags struct { Testnet bool `long:"testnet" description:"Use the test network"` Simnet bool `long:"simnet" description:"Use the simulation test network"` Devnet bool `long:"devnet" description:"Use the development test network"` OverrideDAGParamsFile string `long:"override-dag-params-file" description:"Overrides DAG params (allowed only on devnet)"` ActiveNetParams *dagconfig.Params }
NetworkFlags holds the network configuration, that is which network is selected.
func (*NetworkFlags) NetParams ¶
func (networkFlags *NetworkFlags) NetParams() *dagconfig.Params
NetParams returns the ActiveNetParams
func (*NetworkFlags) ResolveNetwork ¶
func (networkFlags *NetworkFlags) ResolveNetwork(parser *flags.Parser) error
ResolveNetwork parses the network command line argument and sets NetParams accordingly. It returns error if more than one network was selected, nil otherwise.
type ServiceOptions ¶
type ServiceOptions struct {
ServiceCommand string `short:"s" long:"service" description:"Service command {install, remove, start, stop}"`
}
ServiceOptions defines the configuration options for the daemon as a service on Windows.