tests

package
v0.0.0-...-1ceb02d Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseNetwork

func CloseNetwork(servers []network.Server)

CloseNetwork closes all the dial channels.

func ControlSumPreblockConsumer

func ControlSumPreblockConsumer(ps core.PreblockSource, w io.Writer)

ControlSumPreblockConsumer drains the provided source and calculates the hash of each preblock, which depends on Preblock data and previous preblock's hash). When done, writes the result to provided Writer.

func CountingPreblockConsumer

func CountingPreblockConsumer(ps core.PreblockSource, w io.Writer)

CountingPreblockConsumer drains the provided source and counts incoming units. When done, writes the result to provided Writer.

func DataExtractingPreblockConsumer

func DataExtractingPreblockConsumer(ps core.PreblockSource, w io.Writer)

DataExtractingPreblockConsumer reads preblocks from the source and writes all data contained in them to the provided writer.

func EmptyDataSource

func EmptyDataSource() core.DataSource

EmptyDataSource returns a test data source producing empty data.

func NewConnection

func NewConnection() (network.Connection, network.Connection)

NewConnection creates a pipe simulating a pair of network connections.

func NewNetwork

func NewNetwork(length int, timeout time.Duration) []network.Server

NewNetwork returns a slice of interconnected servers that simulate the network of the given size.

func NopPreblockConsumer

func NopPreblockConsumer(ps core.PreblockSource)

NopPreblockConsumer drains the provided source doing nothing with incoming preblocks.

func RandomDataSource

func RandomDataSource(size int) core.DataSource

RandomDataSource returns a test data source producing random slices of data of a given size.

func StdinDataSource

func StdinDataSource() core.DataSource

StdinDataSource returns a test data source producing slices of data taken from the standard input.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements network.Server. Afterwards it needs to be closed with Close().

func (*Server) Dial

func (s *Server) Dial(k uint16) (network.Connection, error)

Dial creates a new connection, pushes one end to the associated dial channel and return the other.

func (*Server) Listen

func (s *Server) Listen() (network.Connection, error)

Listen picks up a connection from the listen channel

func (*Server) Stop

func (s *Server) Stop()

Stop this, linter!

Jump to

Keyboard shortcuts

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