network

package
Version: v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MAX_TCP_ERRORS = 10
	TIMEOUT        = 3 * time.Minute
	PORT_CONNECT   = 22022
	PORT_GET_BLOCK = 22222
	PORT_GET_HEAD  = 22322
	PORT_BROADCAST = 23232
)

Variables

This section is empty.

Functions

This section is empty.

Types

type TCP

type TCP struct {
	DialTimeout time.Duration
	GetTimeout  time.Duration
	// contains filtered or unexported fields
}

func NewTCP

func NewTCP(peers ...string) *TCP

func (*TCP) AddPeer

func (t *TCP) AddPeer(peer string)

func (*TCP) Block

func (t *TCP) Block(reference *bcgo.Reference) (*bcgo.Block, error)

func (*TCP) Broadcast

func (t *TCP) Broadcast(channel bcgo.Channel, cache bcgo.Cache, hash []byte, block *bcgo.Block) error

func (*TCP) Connect

func (t *TCP) Connect(peer string, data []byte) error

func (*TCP) Head

func (t *TCP) Head(channel string) (*bcgo.Reference, error)

func (*TCP) PeerForAddress

func (t *TCP) PeerForAddress(address string) string

Returns the peer associated with the given address

func (*TCP) Peers

func (t *TCP) Peers() (peers []string)

func (*TCP) SetPeers

func (t *TCP) SetPeers(peers ...string)

Source Files

Jump to

Keyboard shortcuts

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