Documentation
¶
Overview ¶
Package phys implements an interface for reading/writing IPX packets to a physical network interface.
Package phys implements a reader/writer object for reading and writing IPX packets from a TAP device.
Index ¶
- Variables
- func CopyFrames(a, b DuplexEthernetStream) error
- func NewTap(cfg water.Config) (*tapWrapper, error)
- func Unframe(pkt gopacket.Packet, framer Framer) ([]byte, bool)
- type ChecksumFixer
- type DuplexEthernetStream
- type Framer
- type PacketDataSink
- type PcapgoDataSink
- type Phys
- type Sink
- type SlirpConnection
- type SlirpProcess
- type Spec
- type Type
Constants ¶
This section is empty.
Variables ¶
var ( Framer802_2 = framer802_2{} Framer802_3Raw = framer802_3Raw{} FramerSNAP = framerSNAP{} FramerEthernetII = framerEthernetII{} FramerAutomatic = &automaticFramer{ fallback: Framer802_2, } )
Functions ¶
func CopyFrames ¶
func CopyFrames(a, b DuplexEthernetStream) error
CopyFrames starts a background process that copies packets between the given two streams.
Types ¶
type ChecksumFixer ¶
type ChecksumFixer struct {
// contains filtered or unexported fields
}
ChecksumFixer is an implementation of `DuplexEthernetStream` that wraps another `DuplexEthernetStream` but recalculates TCP/IP checksums
func NewChecksumFixer ¶
func NewChecksumFixer(stream DuplexEthernetStream) *ChecksumFixer
func (*ChecksumFixer) Close ¶
func (cf *ChecksumFixer) Close()
func (*ChecksumFixer) ReadPacketData ¶
func (cf *ChecksumFixer) ReadPacketData() ([]byte, gopacket.CaptureInfo, error)
func (*ChecksumFixer) WritePacketData ¶
func (cf *ChecksumFixer) WritePacketData(frame []byte) error
type DuplexEthernetStream ¶
type DuplexEthernetStream interface {
gopacket.PacketDataSource
PacketDataSink
}
DuplexEthernetStream extends gopacket.PacketDataSource to an interface where packets can be both read and written.
type Framer ¶
type Framer interface {
Frame(dest net.HardwareAddr, packet *ipx.Packet) ([]gopacket.SerializableLayer, error)
Unframe(eth *layers.Ethernet, layers []gopacket.Layer) ([]byte, bool)
Name() string
}
func FramingTypeFlag ¶
type PacketDataSink ¶
PacketDataSink is the complement to gopacket.PacketDataSource: the WritePacketData method implemented by gopacket's pcap.Handle that allows packets to be written to an output.
type PcapgoDataSink ¶
type PcapgoDataSink interface {
WritePacket(ci gopacket.CaptureInfo, data []byte) error
}
PcapgoDataSink is the packet writing interface implemented by the gopacket/pcapgo writer types.
type Phys ¶
type Phys struct {
*Sink
// contains filtered or unexported fields
}
Phys is an implementation of ipx.ReadWriteCloser that reads and writes IPX packets from a physical network interface.
func NewPhys ¶
func NewPhys(stream DuplexEthernetStream, framer Framer) *Phys
func (*Phys) ReadPacket ¶
ReadPacket implements the ipx.Reader interface, and will block until an IPX packet is read from the physical interface.
type Sink ¶
type Sink struct {
// contains filtered or unexported fields
}
Sink is an implementation of ipx.WriteCloser that frames IPX packets and writes them to a physical network interface.
func NewPcapgoSink ¶
func NewPcapgoSink(pds PcapgoDataSink, framer Framer) *Sink
NewPcapgoSink returns an implementation of ipx.WriteCloser that writes packets to the given pcapgo Writer.
func NewSink ¶
func NewSink(pds PacketDataSink, framer Framer) *Sink
NewSink returns an implementation of ipx.WriteCloser that writes packets to the given gopacket data sink.
type SlirpConnection ¶
type SlirpConnection struct {
// contains filtered or unexported fields
}
func MakeSlirp ¶
func MakeSlirp() (*SlirpConnection, error)
func (*SlirpConnection) Close ¶
func (c *SlirpConnection) Close()
func (*SlirpConnection) ReadPacketData ¶
func (c *SlirpConnection) ReadPacketData() ([]byte, gopacket.CaptureInfo, error)
func (*SlirpConnection) WritePacketData ¶
func (c *SlirpConnection) WritePacketData(buf []byte) error
type SlirpProcess ¶
type SlirpProcess struct {
// contains filtered or unexported fields
}
func (*SlirpProcess) CleanupSocketFiles ¶
func (c *SlirpProcess) CleanupSocketFiles()
func (*SlirpProcess) Close ¶
func (c *SlirpProcess) Close() error
func (*SlirpProcess) Connect ¶
func (c *SlirpProcess) Connect() (*SlirpConnection, error)
func (*SlirpProcess) Start ¶
func (c *SlirpProcess) Start() error
type Spec ¶
func (*Spec) EthernetStream ¶
func (s *Spec) EthernetStream(captureNonIPX bool) (DuplexEthernetStream, error)