packet_injector

package
v0.20.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Namespace Packet_Injector
	Namespace = "Packet_Injector"
)

Variables

This section is empty.

Functions

func InjectPackets added in v0.18.0

func InjectPackets(pp *PacketInjectionParams, g *graph.Graph, chnl *channels) (string, error)

InjectPackets inject some packets based on the graph

Types

type PacketInjectionParams added in v0.18.0

type PacketInjectionParams struct {
	UUID      string
	SrcNodeID graph.Identifier `valid:"nonzero"`
	SrcIP     string           `valid:"nonzero"`
	SrcMAC    string           `valid:"nonzero"`
	SrcPort   int64            `valid:"min=0"`
	DstIP     string           `valid:"nonzero"`
	DstMAC    string           `valid:"nonzero"`
	DstPort   int64            `valid:"min=0"`
	Type      string           `valid:"regexp=^(icmp4|icmp6|tcp4|tcp6|udp4|udp6)$"`
	Count     int64            `valid:"min=1"`
	ID        int64            `valid:"min=0"`
	Interval  int64            `valid:"min=0"`
	Increment bool
	Payload   string
}

PacketInjectionParams describes the packet parameters to be injected

type PacketInjectorClient

type PacketInjectorClient struct {
	*etcd.MasterElector
	// contains filtered or unexported fields
}

PacketInjectorClient describes a packet injector client

func NewPacketInjectorClient

func NewPacketInjectorClient(pool ws.StructSpeakerPool, etcdClient *etcd.Client, piHandler *apiServer.PacketInjectorAPI, g *graph.Graph) *PacketInjectorClient

NewPacketInjectorClient returns a new packet injector client

func (*PacketInjectorClient) InjectPackets added in v0.18.0

func (pc *PacketInjectorClient) InjectPackets(host string, pp *PacketInjectionParams) (string, error)

InjectPackets issues a packet injection request and returns the expected tracking id

func (*PacketInjectorClient) OnStartAsMaster added in v0.16.0

func (pc *PacketInjectorClient) OnStartAsMaster()

OnStartAsMaster event

func (*PacketInjectorClient) OnStartAsSlave added in v0.16.0

func (pc *PacketInjectorClient) OnStartAsSlave()

OnStartAsSlave event

func (*PacketInjectorClient) OnSwitchToMaster added in v0.16.0

func (pc *PacketInjectorClient) OnSwitchToMaster()

OnSwitchToMaster event

func (*PacketInjectorClient) OnSwitchToSlave added in v0.16.0

func (pc *PacketInjectorClient) OnSwitchToSlave()

OnSwitchToSlave event

func (*PacketInjectorClient) Start added in v0.16.0

func (pc *PacketInjectorClient) Start()

Start the packet injector client

func (*PacketInjectorClient) Stop added in v0.16.0

func (pc *PacketInjectorClient) Stop()

Stop the packet injector client

func (*PacketInjectorClient) StopInjection added in v0.16.0

func (pc *PacketInjectorClient) StopInjection(host string, uuid string) error

StopInjection cancels a running packet injection

type PacketInjectorReply added in v0.16.0

type PacketInjectorReply struct {
	TrackingID string
	Error      string
}

PacketInjectorReply describes the reply to a packet injection request

type PacketInjectorServer

type PacketInjectorServer struct {
	Graph    *graph.Graph
	Channels *channels
}

PacketInjectorServer creates a packet injector server API

func NewServer

func NewServer(graph *graph.Graph, pool ws.StructSpeakerPool) *PacketInjectorServer

NewServer creates a new packet injector server API based on websocket server

func (*PacketInjectorServer) OnStructMessage added in v0.19.1

func (pis *PacketInjectorServer) OnStructMessage(c ws.Speaker, msg *ws.StructMessage)

OnMessage event, websocket PIRequest message

Source Files

  • client.go
  • inject_packet.go
  • server.go

Jump to

Keyboard shortcuts

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