node

package
v0.0.0-...-dd5ba33 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{}

DefaultConfig contains reasonable default settings.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Name sets the instance name of the node. It must not contain the / character and is
	// used in the devp2p node identifier. The instance name of gzil is "gzil". If no
	// value is specified, the basename of the current executable is used.
	Name string `toml:"-"`

	// UserIdent, if set, is used as an additional component in the devp2p node identifier.
	UserIdent string `toml:",omitempty"`

	// Version should be set to the version number of the program. It is used
	// in the devp2p node identifier.
	Version string `toml:"-"`

	// DataDir is the file system folder the node should use for any data storage
	// requirements. The configured data directory will not be directly shared with
	// registered services, instead those can use utility mzilods to create/access
	// databases or flat files. This enables ephemeral nodes which can fully reside
	// in memory.
	DataDir string
}

Config represents a small collection of configuration values to fine tune the P2P network layer of a protocol stack. These values can be further extended by all registered services.

func (*Config) NodeName

func (c *Config) NodeName() string

NodeName returns the devp2p node identifier.

type Node

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

Node is a container on which services can be registered.

func New

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

New creates a new node, ready for protocol registration.

func (*Node) Restart

func (n *Node) Restart() error

Restart terminates a running node and boots up a new one in its place. If the node isn't running, an error is returned.

func (*Node) Start

func (n *Node) Start() error

Start create a live P2P node and starts running it.

func (*Node) Stop

func (n *Node) Stop() error

Stop terminates a running node along with all it's services. In the node was not started, an error is returned.

func (*Node) Wait

func (n *Node) Wait()

Wait blocks the thread until the node is stopped. If the node is not running at the time of invocation, the method immediately returns.

Jump to

Keyboard shortcuts

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