protocol

package
v0.0.0-...-a9890c3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Start() error
	Stop() error

	Send([]Packet, net.IP) (int, error)
	SetHandler(HandlerFunc)
}

Handler provides methods of forwarding frames to another endpoint

type HandlerFunc

type HandlerFunc func([]Packet)

HandlerFunc allows callbacks when receiving packets from a remote source

type Packet

type Packet struct {
	VNID   uint32
	Source []byte
	Frame  []byte
}

Packet holds the ethernet frame and the desired VNID

func NewPacket

func NewPacket(vnid uint32, frame []byte) Packet

NewPacket constructs a new packet give an ethernet frame and desired VNID

type TestHandler

type TestHandler struct {
	StoreOutbound bool
	// contains filtered or unexported fields
}

TestHandler provides a way to track and drop output packets and simulate inbound packets

func (*TestHandler) Receive

func (th *TestHandler) Receive(p []Packet) error

Receive allows for packet injection into the tap as if coming from OS

func (*TestHandler) Send

func (th *TestHandler) Send(packets []Packet, rdst net.IP) (int, error)

Send records to the handled

func (*TestHandler) SendOne

func (th *TestHandler) SendOne(packet *Packet, rdst net.IP) (int, error)

SendOne a single record to the handled

func (*TestHandler) SetHandler

func (th *TestHandler) SetHandler(h HandlerFunc)

SetHandler sets the TX handler for l2 forwarding

func (*TestHandler) Start

func (th *TestHandler) Start() error

Start - Fulfil interface

func (*TestHandler) Stats

func (th *TestHandler) Stats() (int, []*Packet)

Stats provides the handled packet count and any stored packets

func (*TestHandler) Stop

func (th *TestHandler) Stop() error

Stop - Fulfil interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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