server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: MIT Imports: 16 Imported by: 7

Documentation

Index

Constants

View Source
const (

	// MaxBlocksPerMsg is the maximum number of blocks allowed per message.
	MaxBlocksPerMsg = 500

	// InvTypeFilteredSideChainBlock type of inventory message has no
	// sideAuxPow in header.
	InvTypeFilteredSideChainBlock msg.InvType = 6
)

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 New

func New(cfg *Config) (*server, error)

New returns a new server instance configured to specified config parameters. 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 added in v0.1.4

type Config struct {
	// DataDir indicates the path the store data files.
	DataDir string

	// Chain represents the BlockChain instance.
	Chain *blockchain.BlockChain

	// TxMemPool represents the TxPool instance.
	TxMemPool *mempool.TxPool

	// ChainParams represents the active net parameters.
	ChainParams *config.Params

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

	// NewTxFilter indicates the function to create a TxFilter according to the
	// TxFilterType.
	NewTxFilter func(filter.TxFilterType) filter.TxFilter
	//node version
	NodeVersion string
}

Config defines the parameters 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) bool

	// 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{})
}

Jump to

Keyboard shortcuts

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