setting

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMinimumFee = 0.05

DefaultMinimumFee is the minimum fee to receive minable tx.

Variables

View Source
var DBVersion = "1.0.0"

DBVersion a version of DB.

View Source
var ErrTorAddress = errors.New("cannot use tor address")

ErrTorAddress represents an error tor address is used.

View Source
var Version = "unreleased"

Version is the version of aknode var Version = "r0.0.0"

Functions

func BaseDir

func BaseDir(s []byte) (string, error)

BaseDir returns base directory from bytes.

Types

type Address

type Address struct {
	Address string `json:"address"`
	Port    uint16 `json:"port"`
}

Address represents an address.

type Setting

type Setting struct {
	Version    string   `json:"-"`
	Debug      bool     `json:"debug"`
	Testnet    byte     `json:"testnet"`
	Blacklists []string `json:"blacklists"`
	RootDir    string   `json:"root_dir"`
	UseTor     bool     `json:"-"` //disabled

	MyHostPort   string   `json:"my_host_port"`
	DefaultNodes []string `json:"default_nodes"`

	Bind           string `json:"bind"`
	Port           uint16 `json:"port"`
	MaxConnections uint16 `json:"max_connections"`
	Proxy          string `json:"proxy"`

	UseWalletRPC      bool   `json:"use_wallet_rpc"`
	UsePublicRPC      bool   `json:"use_public_rpc"`
	RPCBind           string `json:"rpc_bind"`
	RPCPort           uint16 `json:"rpc_port"`
	RPCUser           string `json:"rpc_user"`
	RPCPassword       string `json:"rpc_password"`
	RPCMaxConnections uint16 `json:"rpc_max_connections"`
	RPCTxTag          string `json:"rpc_tx_tag"`
	RPCAllowPublicPoW bool   `json:"rpc_allow_public_pow"`
	WalletNotify      string `json:"wallet_notify"`

	RunValidator    bool     `json:"run_validator"`
	ValidatorSecret string   `json:"validator_secret"`
	TrustedNodes    []string `json:"-"`

	RunExplorer            bool   `json:"run_explorer"`
	ExplorerBind           string `json:"explorer_bind"`
	ExplorerPort           uint16 `json:"explorer_port"`
	ExplorerMaxConnections uint16 `json:"explorer_max_connections"`

	MinimumFee      float64 `json:"minimum_fee"`
	RunFeeMiner     bool    `json:"run_fee_miner"`
	RunTicketMiner  bool    `json:"run_ticket_miner"`
	RunTicketIssuer bool    `json:"run_ticket_issuer"`
	MinerAddress    string  `json:"miner_address"`

	TrustAllNodes bool `json:"trust_all_nodes"` //only for debug

	aklib.DBConfig
	Cancel context.CancelFunc `json:"-"`
	Wg     sync.WaitGroup     `json:"-"`
	WgMsg  sync.WaitGroup     `json:"-"`
}

Setting is a aknode setting.

func GetDefault

func GetDefault(net int) (*Setting, error)

GetDefault returns a default setting (mainnet/testnet/debugnet)

func Load

func Load(s []byte) (*Setting, error)

Load parse a json file fname and returns Settings struct .

func (*Setting) BaseDir

func (s *Setting) BaseDir() string

BaseDir returns a dir which contains a setting file and db dir.

func (*Setting) CheckAddress

func (s *Setting) CheckAddress(adr string, hasPort, isEmptyHost bool) error

CheckAddress checks an address adr.

func (*Setting) InBlacklist

func (s *Setting) InBlacklist(remote string) bool

InBlacklist returns true if remote is in blacklist.

func (*Setting) IsTrusted

func (s *Setting) IsTrusted(adr string) bool

IsTrusted returns true if adr is trusted.

func (*Setting) OpenDB

func (s *Setting) OpenDB() error

OpenDB opens the bolt DB.

func (*Setting) Sign

func (s *Setting) Sign(v proto.Marshaler) (*address.Signature, error)

Sign get a hash for v and retnr the signature.

func (*Setting) ValidatorAddress

func (s *Setting) ValidatorAddress() (*address.Address, error)

ValidatorAddress returns the validator address from ValidatorSecret

func (*Setting) ValidatorsHash

func (s *Setting) ValidatorsHash() []byte

ValidatorsHash returns a hash of validators.

Jump to

Keyboard shortcuts

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