interfaces

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	IfaceOrFileNameIsNeededMsg   = "the interface or pcap file name is needed"
	IfaceValidationFaildMsg      = "the interface validation failed, because"
	PcapFileValidationFaildMsg   = "the pcap filename validation failed, because"
	InvalidIfaceMsg              = "the interface %s is not valid"
	InvalidFilenameMsg           = "the pcap filename %s is not valid"
	InterfaceConfigInitFailedMsg = "interfaces configutation failed, because"
	InterfacesInitMsg            = "interface intiated successfully"
	InterfacesListFailedMsg      = "unable to list system interfaces, because"
	PFRingInitFaildMsg           = "unable to crate new pf_ring object, because"
	LiveSnifferFaildMsg          = "unable to open pcap live sniffer, because"
	OfflineSnifferFaildMsg       = "unable to open pcap offline sniffer, because"
	SettingBPFFilterFailedMsg    = "unable to set the BPF filter, because"
	EnablePFRingFailedMsg        = "while enabling PFRing found"
	PFRingEnabledMsg             = "PFRing enabled successflly"
	PCAPEnabledMsg               = "PCAP sniffer enabled successflly"
	PCAPInitFailMsg              = "while initiating pcap got"
	PFRingInitFailMsg            = "while initiating pf_ring got"
	PFRingNotAvaliableMsg        = "PFRing is not avaliable. Falling down to PCAP sniffer"
	PcapFileNoExistMsg           = "the PCAP file provided does not exist"
	IfaceAndPcapFileMsg          = "Mole cannot handle sniffing from pcap file and an interface at the same time"
	PCAPPFRingMsg                = "PF_Ring cannot be usen when reading offline pcap traffic"
)

Variables

View Source
var (
	ErrIfaceOrFileNotProvided = errors.New(IfaceOrFileNameIsNeededMsg)
	ErrPcapFileNoExist        = errors.New(PcapFileNoExistMsg)
	ErrIfaceAndPcapFile       = errors.New(IfaceAndPcapFileMsg)
	ErrPCAPPFRing             = errors.New(PCAPPFRingMsg)
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// IFace interface to bind to
	IFace string
	// File pcap file to read traffic from
	File string
	// PFRing enable pf_ring
	PFRing bool
	// BPFfilter BPF filter
	BPFfilter string
}

Config interface internal configuration

func InitConfig

func InitConfig() (*Config, error)

InitConfig initializes interface package

type Interfaces

type Interfaces struct {
	// Config interface's configuration most of its values come from the arguments
	// or configuration file
	Config *Config
}

Interfaces is in charge to manage interfaces

func New

func New() (iface *Interfaces, err error)

New builds and configure the interface object

func (*Interfaces) GetHandler added in v0.1.1

func (iface *Interfaces) GetHandler() (handle gopacket.PacketDataSource, err error)

GetHandler returns the data source where the packets will came in from

func (*Interfaces) PFRingAvaliable added in v0.1.1

func (iface *Interfaces) PFRingAvaliable() bool

PFRingAvaliable indicated whether PF Ring is enabled

func (*Interfaces) PFRingEnabled

func (iface *Interfaces) PFRingEnabled() bool

PFRingEnabled indicated whether PF Ring is enabled

func (*Interfaces) TrafficHandler added in v0.1.2

func (iface *Interfaces) TrafficHandler() string

Jump to

Keyboard shortcuts

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