elanet

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func NewServer

func NewServer(dataDir string, cfg *Config) (*server, error)

NewServer returns a new elanet server configured to listen on addr for the network type specified by chainParams. Use start to begin accepting connections from peers.

func UseLogger

func UseLogger(logger elalog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using elalog.

Types

type Config

type Config struct {
	// Chain is the BlockChain instance.
	Chain *blockchain.BlockChain

	// ChainParams is the initial parameters to start the blockchain.
	ChainParams *config.Params

	// PermanentPeers are the peers need to be connected permanently.
	PermanentPeers []string

	// TxMemPool is the transaction mempool.
	TxMemPool *mempool.TxPool

	// BlockMemPool is the block mempool uses by DPOS consensus.
	BlockMemPool *mempool.BlockPool

	// Routes is the DPOS network routes depends on the normal P2P network.
	Routes *routes.Routes
}

Config is the parameters needed to create a Server instance.

type Server

type Server interface {
	svr.IServer

	// Services returns the service flags the server supports.
	Services() pact.ServiceFlag

	// NewPeer adds a new peer that has already been connected to the server.
	NewPeer(p svr.IPeer)

	// DonePeer removes a peer that has already been connected to the server by ip.
	DonePeer(p svr.IPeer)

	// RelayInventory relays the passed inventory vector to all connected peers
	// that are not already known to have it.
	RelayInventory(invVect *msg.InvVect, data interface{})

	// IsCurrent returns whether or not the sync manager believes it is synced
	// with the connected peers.
	IsCurrent() bool
}

Server represent the elanet server.

The interface contract requires that all of these methods are safe for concurrent access.

Directories

Path Synopsis
dns
DNS is a peer-to-peer network address distribute service.
DNS is a peer-to-peer network address distribute service.
This package provides the DPOS routes(network addresses) protocol, it can collect all DPOS peer addresses from the normal P2P network.
This package provides the DPOS routes(network addresses) protocol, it can collect all DPOS peer addresses from the normal P2P network.

Jump to

Keyboard shortcuts

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