common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MachineEndian = binary.LittleEndian

MachineEndian is the endianess of the machine

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {
	// Start starts a dispatcher
	Start() error
	// Stop stops a dispatcher
	Stop() error
	// HandleBroadcast handles the incoming broadcast message. The transportation layer semantics is at least once.
	// That said, the handler is likely to receive duplicate messages.
	HandleBroadcast(proto.Message, chan bool)
	// HandleTell handles the incoming tell message. The transportation layer semantics is exact once. The sender is
	// given for the sake of replying the message
	HandleTell(net.Addr, proto.Message, chan bool)
}

Dispatcher is used by peers, handles incoming block and header notifications and relays announcements of new blocks.

type Node

type Node struct {
	NetworkType string
	Addr        string
}

Node is the root struct to embed the newtork identifier

func NewNode

func NewNode(n string, addr string) *Node

NewNode creates an instance of Peer

func NewTCPNode

func NewTCPNode(addr string) *Node

NewTCPNode creates an instance of Peer with tcp transportation

func (*Node) Network

func (n *Node) Network() string

Network returns the transportation layer type (tcp by default)

func (*Node) String

func (n *Node) String() string

String returns the network address (127.0.0.1:0 by default)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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