network

package
v0.26.17-access-fix-dy... Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: AGPL-3.0 Imports: 7 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
}

Conduit represents a mock conduit.

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.

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(network.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 NetworkPublishFunc) *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 network.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 network.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 NetworkPublishFunc

type NetworkPublishFunc func(network.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