flowtest

package
v0.0.0-...-8fa78e2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

README

This package is under construction

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Start      bool              `json:"start"`
	Interfaces []InterfaceConfig `json:"interfaces"`
	FlowSets   []FlowSetConfig   `json:"flowsets"`
}

func (*Config) Apply

func (c *Config) Apply() error

Process everything in this config structure

func (*Config) GetStart

func (c *Config) GetStart() bool

type EndpointConfig

type EndpointConfig struct {
	Interface string `json:"interface"`
}

type ExpectedFlows

type ExpectedFlows ExpectedList

type ExpectedList

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

func (*ExpectedList) Find

func (l *ExpectedList) Find(id string) *TestPacket

func (*ExpectedList) Insert

func (l *ExpectedList) Insert(record *TestPacket)

func (*ExpectedList) Remove

func (l *ExpectedList) Remove(record *TestPacket)

type Flow

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

type FlowConfig

type FlowConfig struct {
	Source      EndpointConfig `json:"source"`
	Destination EndpointConfig `json:"destination"`
	Send        Packet         `json:"send"`
	Receive     Packet         `json:"receive"`
	Interval    int            `json:"interval"`
}

type FlowSet

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

func FlowSetCreate

func FlowSetCreate(name string) *FlowSet

func (*FlowSet) AddFlow

func (fs *FlowSet) AddFlow(config FlowConfig, ifaces IfaceMap) error

func (*FlowSet) Delete

func (fs *FlowSet) Delete() error

func (*FlowSet) Init

func (fs *FlowSet) Init(config []FlowConfig, ifaces IfaceMap) error

func (*FlowSet) Start

func (fs *FlowSet) Start(ctx context.Context) error

func (*FlowSet) Stop

func (fs *FlowSet) Stop() error

type FlowSetConfig

type FlowSetConfig struct {
	Name  string       `json:"name"`
	Flows []FlowConfig `json:"flows"`
}

func (*FlowSetConfig) GetName

func (t *FlowSetConfig) GetName() string

type FlowTest

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

func CreateAndInit

func CreateAndInit(ctx context.Context) (*FlowTest, error)

create and initialize the flowtest singleton, return the current flowtest singleton with error if it already exists

func Get

func Get() *FlowTest

return a pointer to the (initialized) flowtest singleton

func (*FlowTest) AddFlowSet

func (t *FlowTest) AddFlowSet(config FlowSetConfig) error

func (*FlowTest) AddInterface

func (t *FlowTest) AddInterface(ifName string, mac HexArray, ip HexArray) error

func (*FlowTest) Init

func (t *FlowTest) Init(ctx context.Context)

func (*FlowTest) StartAll

func (t *FlowTest) StartAll() error

func (*FlowTest) StopAll

func (t *FlowTest) StopAll() error

type Flows

type Flows []Flow

func (*Flows) AddFlow

func (f *Flows) AddFlow(flow Flow)

type HexArray

type HexArray []byte

Array of value strings (integer or hex 0x00 type) in json on JSON unmarshal decoded to []byte

func (*HexArray) UnmarshalJSON

func (ha *HexArray) UnmarshalJSON(data []byte) (err error)

type Iface

type Iface struct {
	Name string
	MAC  HexArray
	IP   HexArray
}

func (*Iface) GetIP

func (i *Iface) GetIP() HexArray

func (*Iface) GetMAC

func (i *Iface) GetMAC() HexArray

func (*Iface) GetName

func (i *Iface) GetName() string

type IfaceMap

type IfaceMap map[string]*Iface

type InterfaceConfig

type InterfaceConfig struct {
	Name string   `json:"name"`
	MAC  HexArray `json:"mac"`
	IP   HexArray `json:"ip"`
}

func (*InterfaceConfig) GetIP

func (i *InterfaceConfig) GetIP() HexArray

func (*InterfaceConfig) GetMAC

func (i *InterfaceConfig) GetMAC() HexArray

func (*InterfaceConfig) GetName

func (i *InterfaceConfig) GetName() string

type Intf

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

func (*Intf) Close

func (i *Intf) Close()

close the raw socket if open on this interface

func (*Intf) Open

func (i *Intf) Open()

Open a raw socket if not already open on this interface

type Packet

type Packet struct {
	Layout []string            `json:"layout"`
	Fields map[string]HexArray `json:"fields"`
}

func (Packet) ToByteArray

func (p Packet) ToByteArray(param map[string]HexArray) ([]byte, error)

parses the given fields to an array of bytes by using the given fields and extra parameters

type TestPacket

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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