network

package
v0.37.12 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IpLookupFixture added in v0.23.9

func IpLookupFixture(count int) map[string]*IpLookupTestCase

func NetIPAddrFixture added in v0.23.9

func NetIPAddrFixture() net.IPAddr

func TxtIPFixture added in v0.23.9

func TxtIPFixture() string

func TxtLookupFixture added in v0.23.9

func TxtLookupFixture(count int) map[string]*TxtLookupTestCase

Types

type Conduit

type Conduit struct {
	mocknetwork.Conduit
	// contains filtered or unexported fields
}

func (*Conduit) Publish

func (c *Conduit) Publish(event interface{}, targetIDs ...flow.Identifier) error

Publish sends a message on this mock network, invoking any callback that has been specified. This will panic if no callback is found.

func (*Conduit) ReportMisbehavior added in v0.31.0

func (c *Conduit) ReportMisbehavior(_ network.MisbehaviorReport)

ReportMisbehavior reports the misbehavior of a node on sending a message to the current node that appears valid based on the networking layer but is considered invalid by the current node based on the Flow protocol. This method is a no-op in the test helper implementation.

type Engine

type Engine struct {
	mocknetwork.Engine
}

Engine represents a mock engine. The implementation is not concurrency-safe.

func NewEngine

func NewEngine() *Engine

NewEngine returns a new mock engine.

func (*Engine) OnProcess

func (e *Engine) OnProcess(processFunc EngineProcessFunc) *Engine

OnProcess specifies the callback that should be executed when `Process` is called on this mock engine.

type EngineProcessFunc

type EngineProcessFunc func(channels.Channel, flow.Identifier, interface{}) error

type IpLookupTestCase added in v0.23.9

type IpLookupTestCase struct {
	Domain    string
	Result    []net.IPAddr
	TimeStamp int64
}

func IpLookupListFixture added in v0.23.9

func IpLookupListFixture(count int) []*IpLookupTestCase

type Network

type Network struct {
	mocknetwork.Network
	// contains filtered or unexported fields
}

Network represents a mock network. The implementation is not concurrency-safe.

func NewNetwork

func NewNetwork() *Network

NewNetwork returns a new mock network.

func (*Network) OnPublish

func (n *Network) OnPublish(publishFunc PublishFunc) *Network

OnPublish specifies the callback that should be executed when `Publish` is called on any conduits created by this mock network.

func (*Network) Register

func (n *Network) Register(channel channels.Channel, engine network.MessageProcessor) (network.Conduit, error)

Register registers an engine with this mock network. If an engine is already registered on the given channel, this will return an error.

func (*Network) Send

func (n *Network) Send(channel channels.Channel, originID flow.Identifier, event interface{}) error

Send sends a message to the engine registered to the given channel on this mock network and returns an error if one occurs. If no engine is registered, this is a noop.

type PublishFunc added in v0.31.0

type PublishFunc func(channels.Channel, interface{}, ...flow.Identifier) error

type TxtLookupTestCase added in v0.23.9

type TxtLookupTestCase struct {
	Txt       string
	Records   []string
	TimeStamp int64
}

func TxtLookupListFixture added in v0.23.9

func TxtLookupListFixture(count int) []*TxtLookupTestCase

Jump to

Keyboard shortcuts

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