packetinjector

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 32 Imported by: 3

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func InjectionsMetadataDecoder added in v0.24.0

func InjectionsMetadataDecoder(raw json.RawMessage) (getter.Getter, error)

InjectionsMetadataDecoder implements a json message raw decoder

func NewOnDemandInjectionClient added in v0.24.0

func NewOnDemandInjectionClient(g *graph.Graph, ch rest.WatchableHandler, agentPool ws.StructSpeakerPool, subscriberPool ws.StructSpeakerPool, etcdClient *etcd.Client) *client.OnDemandClient

NewOnDemandInjectionClient creates a new ondemand client based on API, graph and websocket

func NewOnDemandInjectionServer added in v0.24.0

func NewOnDemandInjectionServer(g *graph.Graph, pool *ws.StructClientPool) (*server.OnDemandServer, error)

NewOnDemandInjectionServer creates a new Ondemand probes server based on graph and websocket

Types

type Client

type Client struct {
	etcd.MasterElection
	// contains filtered or unexported fields
}

Client describes a packet injector client

type ForgedPacketGenerator

type ForgedPacketGenerator struct {
	*PacketInjectionRequest
	LayerType gopacket.LayerType
	// contains filtered or unexported fields
}

ForgedPacketGenerator is used to forge packets. It creates a gopacket.Packet with the proper layers that can be directly inserted into a socket.

func NewForgedPacketGenerator

func NewForgedPacketGenerator(pp *PacketInjectionRequest, encapType string) (*ForgedPacketGenerator, error)

NewForgedPacketGenerator returns a new generator of forged packets

func (*ForgedPacketGenerator) Close added in v0.24.0

func (f *ForgedPacketGenerator) Close()

Close the packet generator

func (*ForgedPacketGenerator) PacketSource

func (f *ForgedPacketGenerator) PacketSource() chan *Packet

PacketSource returns a channel when forged packets are pushed

type InjectionMetadata added in v0.24.0

type InjectionMetadata struct {
	PacketInjectionRequest
	ID          string
	State       string
	PacketCount int64
}

InjectionMetadata holds attributes and statistics about an injection easyjson:json gendecoder

func (*InjectionMetadata) GetField added in v0.26.0

func (obj *InjectionMetadata) GetField(key string) (interface{}, error)

func (*InjectionMetadata) GetFieldBool added in v0.26.0

func (obj *InjectionMetadata) GetFieldBool(key string) (bool, error)

func (*InjectionMetadata) GetFieldInt64 added in v0.26.0

func (obj *InjectionMetadata) GetFieldInt64(key string) (int64, error)

func (*InjectionMetadata) GetFieldKeys added in v0.26.0

func (obj *InjectionMetadata) GetFieldKeys() []string

func (*InjectionMetadata) GetFieldString added in v0.26.0

func (obj *InjectionMetadata) GetFieldString(key string) (string, error)

func (InjectionMetadata) MarshalEasyJSON added in v0.26.0

func (v InjectionMetadata) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (InjectionMetadata) MarshalJSON added in v0.26.0

func (v InjectionMetadata) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*InjectionMetadata) MatchBool added in v0.26.0

func (obj *InjectionMetadata) MatchBool(key string, predicate getter.BoolPredicate) bool

func (*InjectionMetadata) MatchInt64 added in v0.26.0

func (obj *InjectionMetadata) MatchInt64(key string, predicate getter.Int64Predicate) bool

func (*InjectionMetadata) MatchString added in v0.26.0

func (obj *InjectionMetadata) MatchString(key string, predicate getter.StringPredicate) bool

func (*InjectionMetadata) UnmarshalEasyJSON added in v0.26.0

func (v *InjectionMetadata) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*InjectionMetadata) UnmarshalJSON added in v0.26.0

func (v *InjectionMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Injections added in v0.24.0

type Injections []*InjectionMetadata

Injections holds the injections metadata easyjson:json gendecoder

func (*Injections) GetField added in v0.26.0

func (obj *Injections) GetField(key string) (interface{}, error)

func (*Injections) GetFieldBool added in v0.26.0

func (obj *Injections) GetFieldBool(key string) (bool, error)

func (*Injections) GetFieldInt64 added in v0.26.0

func (obj *Injections) GetFieldInt64(key string) (int64, error)

func (*Injections) GetFieldKeys added in v0.26.0

func (obj *Injections) GetFieldKeys() []string

func (*Injections) GetFieldString added in v0.26.0

func (obj *Injections) GetFieldString(key string) (string, error)

func (Injections) MarshalEasyJSON added in v0.26.0

func (v Injections) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Injections) MarshalJSON added in v0.26.0

func (v Injections) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Injections) MatchBool added in v0.26.0

func (obj *Injections) MatchBool(key string, predicate getter.BoolPredicate) bool

func (*Injections) MatchInt64 added in v0.26.0

func (obj *Injections) MatchInt64(key string, predicate getter.Int64Predicate) bool

func (*Injections) MatchString added in v0.26.0

func (obj *Injections) MatchString(key string, predicate getter.StringPredicate) bool

func (*Injections) UnmarshalEasyJSON added in v0.26.0

func (v *Injections) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Injections) UnmarshalJSON added in v0.26.0

func (v *Injections) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Packet

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

Packet is defined as a gopacket and it byte representation

func (*Packet) Data added in v0.24.0

func (p *Packet) Data() []byte

Data returns the packet payload as an array of byte

type PacketForger

type PacketForger interface {
	PacketSource() chan *Packet
	Close()
}

PacketForger describes an objects that feeds a channel with packets

type PacketInjectionRequest added in v0.24.0

type PacketInjectionRequest struct {
	rest.BasicResource
	SrcIP            net.IP           `valid:"isIP"`
	SrcMAC           net.HardwareAddr `valid:"isMAC"`
	SrcPort          uint16
	DstIP            net.IP           `valid:"isIP"`
	DstMAC           net.HardwareAddr `valid:"isMAC"`
	DstPort          uint16
	Type             string `valid:"regexp=^(icmp4|icmp6|tcp4|tcp6|udp4|udp6)$"`
	Count            uint64 `valid:"min=1"`
	ICMPID           uint16
	Interval         uint64
	Mode             string
	IncrementPayload int64
	Payload          string
	Pcap             []byte
	TTL              uint8
}

PacketInjectionRequest describes the packet parameters to be injected easyjson:json

func (*PacketInjectionRequest) GetID added in v0.27.0

func (r *PacketInjectionRequest) GetID() string

GetID returns the id of the packet injection request

func (*PacketInjectionRequest) GetName added in v0.24.0

func (r *PacketInjectionRequest) GetName() string

GetName returns the name of the resource

func (PacketInjectionRequest) MarshalEasyJSON added in v0.26.0

func (v PacketInjectionRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PacketInjectionRequest) MarshalJSON added in v0.26.0

func (v PacketInjectionRequest) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PacketInjectionRequest) SetID added in v0.24.0

func (r *PacketInjectionRequest) SetID(id string)

SetID sets the id of the packet injection request

func (*PacketInjectionRequest) UnmarshalEasyJSON added in v0.26.0

func (v *PacketInjectionRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PacketInjectionRequest) UnmarshalJSON added in v0.26.0

func (v *PacketInjectionRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PcapPacketGenerator

type PcapPacketGenerator struct {
	*PacketInjectionRequest
	// contains filtered or unexported fields
}

PcapPacketGenerator reads packets from a pcap file and inject it into a channel

func NewPcapPacketGenerator

func NewPcapPacketGenerator(pp *PacketInjectionRequest) (*PcapPacketGenerator, error)

NewPcapPacketGenerator returns a new pcap packet generator

func (*PcapPacketGenerator) Close added in v0.24.0

func (p *PcapPacketGenerator) Close()

Close the packet generator

func (*PcapPacketGenerator) PacketSource

func (p *PcapPacketGenerator) PacketSource() chan *Packet

PacketSource returns a channel when pcap packets are pushed

type Reply

type Reply struct {
	TrackingID string
	Error      string
}

Reply describes the reply to a packet injection request

Jump to

Keyboard shortcuts

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