adapters

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

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

Go to latest
Published: Sep 20, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrDeviceAdapterNotInitialized = "device adapter not initialized"
	ErrCouldNotActivate            = "could not activate capture interface"
)

constants...

View Source
const (
	ErrNetworkWriterNotSupported = "writer not supported for server"
	ErrNetworkReaderNotSupported = "reader not supported for client"
	ErrNetworkReadHeader         = "could not read header from network"
	ErrNetworkReadChunk          = "could not read chunk from network"
)

constants...

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceAdapter

type DeviceAdapter struct {
	goul.Adapter
	ID string
	// contains filtered or unexported fields
}

DeviceAdapter is an adapter for the network device interfacing. This is the most important adapter of Goul. It is used as a reader adapter for the sender and a writer adapter for the receiver.

Please note that the adapter MUST be initialized with NewDevice() function so that it can be initialized with initialization of device and automatically inherit the BaseAdapter that implements underlying CommonMixin. Otherwise, it does not work properly.

func NewDevice

func NewDevice(dev string, isTest bool) (*DeviceAdapter, error)

NewDevice returns new device adapter.

func (*DeviceAdapter) Close

func (a *DeviceAdapter) Close() (err error)

Close clean up resources on device adapter.

func (*DeviceAdapter) Read

func (a *DeviceAdapter) Read(ctrl chan goul.Item, message goul.Message) (out chan goul.Item, err error)

Read implements interface Adapter

func (*DeviceAdapter) SetFilter

func (a *DeviceAdapter) SetFilter(filter string) error

SetFilter sets filter string which is applied while capturing.

func (*DeviceAdapter) SetOptions

func (a *DeviceAdapter) SetOptions(promisc bool, snaplength int, timeout time.Duration) (err error)

SetOptions sets capture options to inactive handler.

func (*DeviceAdapter) Write

func (a *DeviceAdapter) Write(in chan goul.Item, message goul.Message) (done chan goul.Item, err error)

Write implements interface Adapter

type DummyAdapter

type DummyAdapter struct {
	goul.Adapter
	ID string
}

DummyAdapter ...

func (*DummyAdapter) Read

func (a *DummyAdapter) Read(in chan goul.Item, message goul.Message) (chan goul.Item, error)

Read implements interface Adapter

func (*DummyAdapter) Write

func (a *DummyAdapter) Write(in chan goul.Item, message goul.Message) (chan goul.Item, error)

Write implements interface Adapter

type NetworkAdapter

type NetworkAdapter struct {
	goul.Adapter
	ID string
	// contains filtered or unexported fields
}

NetworkAdapter is normal mode networking adapter.

func NewNetwork

func NewNetwork(addr string, port int) (*NetworkAdapter, error)

NewNetwork ...

func (*NetworkAdapter) Close

func (a *NetworkAdapter) Close() error

Close implements Adapter:

func (*NetworkAdapter) Read

func (a *NetworkAdapter) Read(ctrl chan goul.Item, message goul.Message) (chan goul.Item, error)

Read implements interface Adapter

func (*NetworkAdapter) Write

func (a *NetworkAdapter) Write(in chan goul.Item, message goul.Message) (chan goul.Item, error)

Write implements interface Adapter

Jump to

Keyboard shortcuts

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