server

package
v0.0.0-...-e920dd0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: MIT Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (

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

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 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 Server

type Server struct {
	p2psvr.IServer
	// contains filtered or unexported fields
}

server provides a server for handling communications to and from peers.

func New

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

New returns a new server instance configured to specified config parameters. Use start to begin accepting connections from peers.

func (*Server) DonePeer

func (s *Server) DonePeer(p p2psvr.IPeer)

DonePeer removes a peer that has already been connected to the server by ip.

func (*Server) NewPeer

func (s *Server) NewPeer(p p2psvr.IPeer)

NewPeer adds a new peer that has already been connected to the server.

func (*Server) RelayInventory

func (s *Server) RelayInventory(invVect *msg.InvVect, data interface{})

RelayInventory relays the passed inventory vector to all connected peers that are not already known to have it.

func (*Server) Services

func (s *Server) Services() pact.ServiceFlag

Services returns the service flags the server supports.

func (*Server) Start

func (s *Server) Start()

Start begins accepting connections from peers.

func (*Server) Stop

func (s *Server) Stop() error

Stop gracefully shuts down the server by stopping and disconnecting all peers and the main listener.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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