transport

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitFakeListeners

func WaitFakeListeners(count int32, timeout time.Duration) error

WaitFakeListeners wait for streamTransports will be started this is used to prevent race in tests

Types

type DatagramHandler

type DatagramHandler interface {
	HandleDatagram(ctx context.Context, address string, buf []byte)
}

DatagramHandler interface provides callback method to process received datagrams

type DatagramTransport

type DatagramTransport interface {
	component.Starter
	component.Stopper

	SendDatagram(ctx context.Context, address string, data []byte) error
	Address() string
}

DatagramTransport interface provides methods to send and receive datagrams

type Factory

type Factory interface {
	CreateStreamTransport(StreamHandler) (StreamTransport, error)
	CreateDatagramTransport(DatagramHandler) (DatagramTransport, error)
}

Factory interface provides methods for creating stream or datagram transports

func NewFactory

func NewFactory(cfg configuration.Transport) Factory

NewFactory constructor creates new transport factory

func NewFakeFactory

func NewFakeFactory(cfg configuration.Transport) Factory

NewFakeFactory constructor creates new fake transport factory

type StreamHandler

type StreamHandler interface {
	HandleStream(ctx context.Context, address string, stream io.ReadWriteCloser)
}

StreamHandler interface provides callback method to process data stream

type StreamTransport

type StreamTransport interface {
	component.Starter
	component.Stopper

	Dial(ctx context.Context, address string) (io.ReadWriteCloser, error)
	Address() string
}

StreamTransport interface provides methods to send and receive data streams

Jump to

Keyboard shortcuts

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