node

package
v2.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: GPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataDirUsed             = errors.New("dataDir already used by another process")
	ErrNodeStopped             = errors.New("node not started")
	ErrNodeRunning             = errors.New("node already running")
	ErrServiceUnknown          = errors.New("unknown service")
	ErrWalletConfigNil         = errors.New("wallet config is nil")
	ErrEntropyStorePathInvalid = errors.New("entropyStorePath is invalid")
	ErrViteConfigNil           = errors.New("vite config is nil")
	ErrP2PConfigNil            = errors.New("p2p config is nil")
)
View Source
var DefaultNodeConfig = Config{
	Identity:        "nodeServer",
	IPCPath:         "gvite.ipc",
	DataDir:         DefaultDataDir(),
	KeyStoreDir:     DefaultDataDir(),
	HttpPort:        common.DefaultHTTPPort,
	WSPort:          common.DefaultWSPort,
	Discover:        true,
	LogLevel:        "info",
	WSOrigins:       []string{"*"},
	WSExposeAll:     true,
	HttpExposeAll:   true,
	ListenInterface: discovery.DefaultListenInterface,
	Port:            discovery.DefaultPort,
	FilePort:        net.DefaultFilePort,
	ForwardStrategy: net.DefaultForwardStrategy,
	AccessControl:   "any",
}

Functions

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir is the default data directory to use for the databases and other persistence requirements.

Types

type Config

type Config struct {
	NetSelect string

	DataDir string `json:"DataDir"`

	KeyStoreDir string `json:"KeyStoreDir"`

	// template:["broker1,broker2,...|topic",""]
	KafkaProducers []string `json:"KafkaProducers"`

	// chain
	LedgerGcRetain uint64 `json:"LedgerGcRetain"`
	LedgerGc       *bool  `json:"LedgerGc"`
	OpenPlugins    *bool  `json:"OpenPlugins"`

	// genesis
	GenesisFile string `json:"GenesisFile"`

	// p2p
	Identity        string   `json:"Identity"`
	PeerKey         string   `json:"PeerKey"`
	PrivateKey      string   `json:"PrivateKey"`
	MaxPeers        int      `json:"MaxPeers"`
	MinPeers        int      `json:"MinPeers"`
	MaxInboundRatio int      `json:"MaxInboundRatio"`
	MaxPendingPeers int      `json:"MaxPendingPeers"`
	BootNodes       []string `json:"BootNodes"`
	BootSeeds       []string `json:"BootSeeds"`
	StaticNodes     []string `json:"StaticNodes"`
	ListenInterface string   `json:"ListenInterface"`
	Port            int      `json:"Port"`
	ListenAddress   string   `json:"ListenAddress"`
	PublicAddress   string   `json:"PublicAddress"`
	NetID           int      `json:"NetID"`
	Discover        bool     `json:"Discover"`
	AccessControl   string   `json:"AccessControl"` // producer special any
	AccessAllowKeys []string `json:"AccessAllowKeys"`
	AccessDenyKeys  []string `json:"AccessDenyKeys"`

	//producer
	EntropyStorePath     string `json:"EntropyStorePath"`
	EntropyStorePassword string `json:"EntropyStorePassword"`
	CoinBase             string `json:"CoinBase"`
	MinerEnabled         bool   `json:"Miner"`
	MinerInterval        int    `json:"MinerInterval"`

	//rpc
	RPCEnabled bool `json:"RPCEnabled"`
	IPCEnabled bool `json:"IPCEnabled"`
	WSEnabled  bool `json:"WSEnabled"`

	IPCPath          string   `json:"IPCPath"`
	HttpHost         string   `json:"HttpHost"`
	HttpPort         int      `json:"HttpPort"`
	HttpVirtualHosts []string `json:"HttpVirtualHosts"`
	WSHost           string   `json:"WSHost"`
	WSPort           int      `json:"WSPort"`

	HTTPCors            []string `json:"HTTPCors"`
	WSOrigins           []string `json:"WSOrigins"`
	PublicModules       []string `json:"PublicModules"`
	WSExposeAll         bool     `json:"WSExposeAll"`
	HttpExposeAll       bool     `json:"HttpExposeAll"`
	TestTokenHexPrivKey string   `json:"TestTokenHexPrivKey"`
	TestTokenTti        string   `json:"TestTokenTti"`

	PowServerUrl string `json:"PowServerUrl"`

	//Log level
	LogLevel    string `json:"LogLevel"`
	ErrorLogDir string `json:"ErrorLogDir"`

	//VM
	VMTestEnabled      bool `json:"VMTestEnabled"`
	VMTestParamEnabled bool `json:"VMTestParamEnabled"`
	VMDebug            bool `json:"VMDebug"`

	// subscribe
	SubscribeEnabled bool `json:"SubscribeEnabled"`

	// net
	Single            bool   `json:"Single"`
	FilePort          int    `json:"FilePort"`
	FileListenAddress string `json:"FileListenAddress"`
	FilePublicAddress string `json:"FileAddress"`
	ForwardStrategy   string `json:"ForwardStrategy"`
	TraceEnabled      bool   `json:"TraceEnabled"`

	// dashboard
	DashboardTargetURL string

	// reward
	RewardAddr string `json:"RewardAddr"`

	//metrics
	MetricsEnable    *bool   `json:"MetricsEnable"`
	InfluxDBEnable   *bool   `json:"InfluxDBEnable"`
	InfluxDBEndpoint *string `json:"InfluxDBEndpoint"`
	InfluxDBDatabase *string `json:"InfluxDBDatabase"`
	InfluxDBUsername *string `json:"InfluxDBUsername"`
	InfluxDBPassword *string `json:"InfluxDBPassword"`
	InfluxDBHostTag  *string `json:"InfluxDBHostTag"`
}

func (*Config) DataDirPathAbs

func (c *Config) DataDirPathAbs() error

resolve the dataDir so future changes to the current working directory don't affect the node

func (*Config) GetPrivateKey

func (c *Config) GetPrivateKey() ed25519.PrivateKey

func (*Config) HTTPEndpoint

func (c *Config) HTTPEndpoint() string

func (*Config) IPCEndpoint

func (c *Config) IPCEndpoint() string

func (*Config) RunErrorLogHandler

func (c *Config) RunErrorLogHandler() log15.Handler

func (*Config) RunLogDir

func (c *Config) RunLogDir() string

func (*Config) RunLogHandler

func (c *Config) RunLogHandler() log15.Handler

func (*Config) SetPrivateKey

func (c *Config) SetPrivateKey(privateKey string)

func (*Config) WSEndpoint

func (c *Config) WSEndpoint() string

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node is chain container that manages p2p、rpc、vite modules

func New

func New(conf *Config) (*Node, error)

func (*Node) Attach

func (node *Node) Attach() (*rpc.Client, error)

func (*Node) Config

func (node *Node) Config() *Config

func (*Node) GetHttpApis

func (node *Node) GetHttpApis() []rpc.API

Http apis

func (*Node) GetInProcessApis

func (node *Node) GetInProcessApis() []rpc.API

In-proc apis

func (*Node) GetIpcApis

func (node *Node) GetIpcApis() []rpc.API

Ipc apis

func (*Node) GetWSApis

func (node *Node) GetWSApis() []rpc.API

WS apis

func (*Node) Prepare

func (node *Node) Prepare() (err error)

func (*Node) Start

func (node *Node) Start() error

func (*Node) Stop

func (node *Node) Stop() error

func (*Node) Vite

func (node *Node) Vite() *vite.Vite

func (*Node) ViteConfig added in v1.3.0

func (node *Node) ViteConfig() *config.Config

func (*Node) ViteServer

func (node *Node) ViteServer() *vite.Vite

func (*Node) Wait

func (node *Node) Wait()

func (*Node) WalletManager

func (node *Node) WalletManager() *wallet.Manager

Jump to

Keyboard shortcuts

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