network

package
v0.0.0-...-4214274 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package network is generated by Handlergenerator tooling Make sure to insert real Description here

Package network is generated by Handlergenerator tooling OpenPcap will open up a pcap and output all network packets to the next processor

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrNoDevicesFound is when the system has no network interfaces to sniff on
	ErrNoDevicesFound = errors.New("no sniffable devices found on the system")
	//ErrConfiguredInterface is thrown when the wanted interface does not exist
	ErrConfiguredInterface = errors.New("there is no such interface, try checking your systems network interfaces names")
)

Functions

func FindDevices

func FindDevices() ([]pcap.Interface, error)

FindDevices prints all network interface info

func NewNetworkInterfaceHandler

func NewNetworkInterfaceHandler() handlers.Handler

NewNetworkInterfaceHandler generates a new NetworkInterface Handler

func NewOpenPcapHandler

func NewOpenPcapHandler() handlers.Handler

NewOpenPcapHandler generates a new OpenPcap Handler

Types

type NetworkInterface

type NetworkInterface struct {
	// Cfg is values needed to properly run the Handle func
	Cfg *property.Configuration `json:"configs" yaml:"configs"`
	// Name is sort of like an ID used to load data back should be the same that is used to register the Handler
	Name string `json:"handler_name" yaml:"handler_name"`

	// MetricPayloadOut is how many payloads the processor has outputted
	MetricPayloadOut string
	// MetricPayloadIn is how many payloads the processor has inputted
	MetricPayloadIn string
	// contains filtered or unexported fields
}

NetworkInterface is used to read packets from a network interface

func (*NetworkInterface) GetConfiguration

func (a *NetworkInterface) GetConfiguration() *property.Configuration

GetConfiguration will return the CFG for the Handler

func (*NetworkInterface) GetErrorChannel

func (a *NetworkInterface) GetErrorChannel() chan error

GetErrorChannel will return a channel that the Handler can output eventual errors onto

func (*NetworkInterface) GetHandlerName

func (a *NetworkInterface) GetHandlerName() string

GetHandlerName should return the name of the handler that was used in register

func (*NetworkInterface) Handle

func (a *NetworkInterface) Handle(ctx context.Context, input payload.Payload, topics ...string) error

Handle is used to sniff network packets on a interface and output all packets

func (*NetworkInterface) SetMetricProvider

func (a *NetworkInterface) SetMetricProvider(p metric.Provider, prefix string) error

SetMetricProvider is used to change what metrics provider is used by the handler

func (*NetworkInterface) Subscriptionless

func (a *NetworkInterface) Subscriptionless() bool

Subscriptionless will return true/false if the Handler is genereating payloads itself

func (*NetworkInterface) ValidateConfiguration

func (a *NetworkInterface) ValidateConfiguration() (bool, []string)

ValidateConfiguration is used to see that all needed configurations are assigned before starting

type OpenPcap

type OpenPcap struct {
	// Cfg is values needed to properly run the Handle func
	Cfg *property.Configuration `json:"configs" yaml:"configs"`
	// Name is sort of like an ID used to load data back should be the same that is used to register the Handler
	Name string `json:"handler_name" yaml:"handler_name"`

	// MetricPayloadOut is how many payloads the processor has outputted
	MetricPayloadOut string
	// MetricPayloadIn is how many payloads the processor has inputted
	MetricPayloadIn string
	// contains filtered or unexported fields
}

OpenPcap is used to open up a PCAP and Read the packets from the pcap.

func (*OpenPcap) GetConfiguration

func (a *OpenPcap) GetConfiguration() *property.Configuration

GetConfiguration will return the CFG for the Handler

func (*OpenPcap) GetErrorChannel

func (a *OpenPcap) GetErrorChannel() chan error

GetErrorChannel will return a channel that the Handler can output eventual errors onto

func (*OpenPcap) GetHandlerName

func (a *OpenPcap) GetHandlerName() string

GetHandlerName should return the name of the handler that was used in register

func (*OpenPcap) Handle

func (a *OpenPcap) Handle(ctx context.Context, input payload.Payload, topics ...string) error

Handle is used to open a pcap and output all network packets

func (*OpenPcap) SetMetricProvider

func (a *OpenPcap) SetMetricProvider(p metric.Provider, prefix string) error

SetMetricProvider is used to change what metrics provider is used by the handler

func (*OpenPcap) Subscriptionless

func (a *OpenPcap) Subscriptionless() bool

Subscriptionless will return true/false if the Handler is genereating payloads itself

func (*OpenPcap) ValidateConfiguration

func (a *OpenPcap) ValidateConfiguration() (bool, []string)

ValidateConfiguration is used to see that all needed configurations are assigned before starting

Jump to

Keyboard shortcuts

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