device

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugCapture added in v0.1.0

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

DebugCapture handles PCAP capture for debugging

func NewDebugCapture added in v0.1.0

func NewDebugCapture(targetIP, outputFile string) (*DebugCapture, error)

NewDebugCapture creates a new debug capture instance

func (*DebugCapture) CaptureOutgoingPacket added in v0.1.0

func (dc *DebugCapture) CaptureOutgoingPacket(data []byte)

CaptureOutgoingPacket captures an outgoing packet with current timestamp

func (*DebugCapture) CapturePacket added in v0.1.0

func (dc *DebugCapture) CapturePacket(data []byte, ci gopacket.CaptureInfo)

CapturePacket captures a packet if it matches the target IP

func (*DebugCapture) Close added in v0.1.0

func (dc *DebugCapture) Close()

Close closes the debug capture and waits for all packets to be written

type Device

type Device interface {
	stack.LinkEndpoint

	// Name returns the current name of the device.
	Name() string

	// Type returns the driver type of the device.
	Type() string
}

Device is the interface that implemented by network layer devices (e.g. tun), and easy to use as stack.LinkEndpoint.

func Open

func Open(pcapCfg cfg.PCAP, captureCfg cfg.Capture, ifce net.Interface, netConfig *NetworkConfig, stacker func() Stacker) (_ Device, err error)

type NetworkConfig added in v0.1.0

type NetworkConfig struct {
	Network  *net.IPNet
	LocalIP  net.IP
	LocalMAC net.HardwareAddr
	MTU      uint32
}

NetworkConfig holds the parsed network configuration

type PCAP

type PCAP struct {
	*ethernet.Endpoint

	Interface net.Interface
	// contains filtered or unexported fields
}

func (*PCAP) Close

func (t *PCAP) Close()

func (*PCAP) Name

func (t *PCAP) Name() string

func (*PCAP) Read

func (t *PCAP) Read() []byte

func (*PCAP) SetHardwareAddr

func (t *PCAP) SetHardwareAddr(srcIP net.IP, srcMAC net.HardwareAddr)

func (*PCAP) Type

func (t *PCAP) Type() string

func (*PCAP) Write

func (t *PCAP) Write(p []byte) (n int, err error)

type Stacker

type Stacker interface {
	AddStaticNeighbor(nicID tcpip.NICID, protocol tcpip.NetworkProtocolNumber, addr tcpip.Address, linkAddr tcpip.LinkAddress) tcpip.Error
	AddProtocolAddress(id tcpip.NICID, protocolAddress tcpip.ProtocolAddress, properties stack.AddressProperties) tcpip.Error
}

Directories

Path Synopsis
Package iobased provides the implementation of io.ReadWriter based data-link layer endpoints.
Package iobased provides the implementation of io.ReadWriter based data-link layer endpoints.

Jump to

Keyboard shortcuts

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