phys

package
v0.0.0-...-56ea410 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2020 License: ISC Imports: 8 Imported by: 0

Documentation

Overview

Package phys implements a physical packet interface that uses libpcap to send and receive packets on a physical network interface.

Package phys implements a reader/writer object for reading and writing IPX packets from a TAP device.

Index

Constants

This section is empty.

Variables

View Source
var (
	Framer802_2      = framer802_2{}
	Framer802_3Raw   = framer802_3Raw{}
	FramerSNAP       = framerSNAP{}
	FramerEthernetII = framerEthernetII{}
)

Functions

func GetIPXPayload

func GetIPXPayload(pkt gopacket.Packet) ([]byte, bool)

GetIPXPayload parses the layers in the given packet to locate and extract an IPX payload.

Types

type Framer

type Framer interface {
	Frame(dest net.HardwareAddr, packet []byte) ([]gopacket.SerializableLayer, error)
}

type PcapPhys

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

func NewPcap

func NewPcap(handle *pcap.Handle, framer Framer) (*PcapPhys, error)

func (*PcapPhys) Close

func (p *PcapPhys) Close() error

func (*PcapPhys) Read

func (p *PcapPhys) Read(result []byte) (int, error)

Read implements the io.Reader interface, and will block until an IPX packet is received from the pcap handle.

func (*PcapPhys) Write

func (p *PcapPhys) Write(packet []byte) (int, error)

Write writes an ethernet frame to the pcap handle containing the given IPX packet as payload.

type Phys

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

func New

func New(cfg water.Config) (*Phys, error)

New creates a new physical IPX interface.

func (*Phys) Close

func (p *Phys) Close() error

func (*Phys) Read

func (p *Phys) Read(result []byte) (int, error)

Read implements the io.Reader interface, and will block until an IPX packet is received from the TAP device.

func (*Phys) Write

func (p *Phys) Write(packet []byte) (int, error)

Write writes an ethernet frame to the TAP interface containing the given IPX packet as payload.

Jump to

Keyboard shortcuts

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