conf

package
v0.0.0-...-e2b9c72 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2018 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppMajor uint = 0
	AppMinor uint = 0
	AppPatch uint = 1

	// AppPreRelease MUST only contain characters from semanticAlphabet
	// per the semantic versioning spec.
	AppPreRelease = "beta"
)

These constants define the application version and follow the semantic versioning 2.0.0 spec (http://semver.org/).

Variables

View Source
var DataDir string

Functions

func AppDataDir

func AppDataDir(appName string, roaming bool) string

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 CopyFile

func CopyFile(src, des string) (w int64, err error)

func ExistDataDir

func ExistDataDir(datadir string) bool

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 Configuration

type Configuration struct {
	GoVersion string `validate:"require"` //description:"Display version information and exit"
	Version   string `validate:"require"` //description:"Display version information of copernicus"
	BuildDate string `validate:"require"` //description:"Display build date of copernicus"
	DataDir   string `default:"data"`

	// Service struct {
	// 	Address string `default:"1.0.0.1:80"`
	// }
	RPC struct {
		RPCListeners         []string // Add an interface/port to listen for RPC connections (default port: 8334, testnet: 18334)
		RPCUser              string   // Username for RPC connections
		RPCPass              string   // Password for RPC connections
		RPCLimitUser         string   //Username for limited RPC connections
		RPCLimitPass         string   //Password for limited RPC connections
		RPCCert              string   `default:""` //File containing the certificate file
		RPCKey               string   //File containing the certificate key
		RPCMaxClients        int      //Max number of RPC clients for standard connections
		RPCMaxWebsockets     int      //Max number of RPC websocket connections
		RPCMaxConcurrentReqs int      //Max number of concurrent RPC requests that may be processed concurrently
		RPCQuirks            bool     //Mirror some JSON-RPC quirks of Bitcoin Core -- NOTE: Discouraged unless interoperability issues need to be worked around
	}
	Log struct {
		Level    string   //description:"Define level of log,include trace, debug, info, warn, error"
		Module   []string // only output the specified module's log when using log.Print(...)
		FileName string   // the name of log file
	}
	Mempool struct {
		MinFeeRate           int64 //
		LimitAncestorCount   int   // Default for -limitancestorcount, max number of in-mempool ancestors
		LimitAncestorSize    int   // Default for -limitancestorsize, maximum kilobytes of tx + all in-mempool ancestors
		LimitDescendantCount int   // Default for -limitdescendantcount, max number of in-mempool descendants
		LimitDescendantSize  int   // Default for -limitdescendantsize, maximum kilobytes of in-mempool descendants
		MaxPoolSize          int   // Default for MaxPoolSize, maximum megabytes of mempool memory usage
		MaxPoolExpiry        int   // Default for -mempoolexpiry, expiration time for mempool transactions in hours
	}
	P2PNet struct {
		ListenAddrs         []string `validate:"require" default:"1234"`
		MaxPeers            int      `default:"128"`
		TargetOutbound      int      `default:"8"`
		ConnectPeersOnStart []string
		DisableBanning      bool `default:"true"`
		BanThreshold        uint32
		SimNet              bool          `default:"false"`
		DisableListen       bool          `default:"true"`
		BlocksOnly          bool          `default:"true"` //Do not accept transactions from remote peers.
		BanDuration         time.Duration // How long to ban misbehaving peers
		Proxy               string        // Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)
		UserAgentComments   []string      // Comment to add to the user agent -- See BIP 14 for more information.
		DisableDNSSeed      bool          //Disable DNS seeding for peers
		DisableRPC          bool          `default:"false"`
		DisableTLS          bool          `default:"false"`
		Whitelists          []*net.IPNet
		NoOnion             bool     `default:"true"`  // Disable connecting to tor hidden services
		Upnp                bool     `default:"false"` // Use UPnP to map our listening port outside of NAT
		ExternalIPs         []string // Add an ip to the list of local addresses we claim to listen on to peers

	}
	AddrMgr struct {
		SimNet       bool
		ConnectPeers []string
	}
	Protocal struct {
		NoPeerBloomFilters bool `default:"true"`
		DisableCheckpoints bool `default:"true"`
	}
	Script struct {
		AcceptDataCarrier   bool `default:"true"`
		MaxDatacarrierBytes uint `default:"83"`
		IsBareMultiSigStd   bool `default:"true"`
		//use promiscuousMempoolFlags to make more or less check of script, the type of value is uint
		PromiscuousMempoolFlags string
	}
	TxOut struct {
		DustRelayFee int64 `default:"83"`
	}
	Chain struct {
		AssumeValid string
	}
	Mining struct {
		BlockMinTxFee int64  // default DefaultBlockMinTxFee
		BlockMaxSize  uint64 // default DefaultMaxGeneratedBlockSize
		BlockVersion  int32  `default:"-1"`
		Strategy      string `default:"ancestorfeerate"` // option:ancestorfee/ancestorfeerate
	}
}

Configuration defines all configurations for application

var Cfg *Configuration

func (Configuration) Validate

func (c Configuration) Validate() error

Validate validates configuration

Jump to

Keyboard shortcuts

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