Documentation ¶
Index ¶
- Constants
- type BPF
- type BPFTerm
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(b []byte) (n int, err error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(b []byte) (n int, err error)
- type EthAddr
- type EthernetII
- type EthernetInterface
- func (e *EthernetInterface) Close()
- func (e *EthernetInterface) GetIfIndex() uint32
- func (e *EthernetInterface) GetMACAddress() MACAddr
- func (e *EthernetInterface) MCastJoin(addr MACAddr) error
- func (e *EthernetInterface) NewConn(dest MACAddr) net.Conn
- func (e *EthernetInterface) RecvPacket() (pkt []byte, src MACAddr, err error)
- func (e *EthernetInterface) SendPacket(dst MACAddr, pkt []byte) error
- type EthernetInterfaceFactory
- type EthernetInterfaceFactoryI
- type EthernetInterfaceI
- type LLC
- type MACAddr
- type MockEthernetInterface
- func (mei *MockEthernetInterface) Close()
- func (mei *MockEthernetInterface) DrainBuffer()
- func (mei *MockEthernetInterface) GetMTU() int
- func (mei *MockEthernetInterface) MCastJoin(addr MACAddr) error
- func (mei *MockEthernetInterface) ReceiveAtRemote() (MACAddr, []byte)
- func (mei *MockEthernetInterface) RecvPacket() (pkt []byte, src MACAddr, err error)
- func (mei *MockEthernetInterface) SendFromRemote(src MACAddr, pkt []byte)
- func (mei *MockEthernetInterface) SendPacket(dst MACAddr, pkt []byte) error
- type MockEthernetInterfaceFactory
Constants ¶
View Source
const MockEthernetInterfaceBufferSize = 1024
View Source
const (
TYPE_ARP = 0x0806
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BPF ¶
type BPF struct {
// contains filtered or unexported fields
}
BPF represents a Berkeley Packet Filter
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a wrapper that implements net.Conn and sents packets to a particular destination (write only)
func (*Conn) RemoteAddr ¶
RemoteAddr returns the remote address
func (*Conn) SetDeadline ¶
SetDeadline is here to fulfill the net.Conn interface
func (*Conn) SetReadDeadline ¶
SetReadDeadline is here to fulfill the net.Conn interface
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline is here to fulfill the net.Conn interface
type EthAddr ¶
type EthAddr struct {
// contains filtered or unexported fields
}
EthAddr implements net.Addr
type EthernetII ¶
func (*EthernetII) Serialize ¶
func (e *EthernetII) Serialize(buf *bytes.Buffer)
type EthernetInterface ¶
type EthernetInterface struct {
// contains filtered or unexported fields
}
func NewEthernetInterface ¶
func NewEthernetInterface(devName string, bpf *BPF, protocol uint16) (*EthernetInterface, error)
func (*EthernetInterface) GetIfIndex ¶
func (e *EthernetInterface) GetIfIndex() uint32
func (*EthernetInterface) GetMACAddress ¶
func (e *EthernetInterface) GetMACAddress() MACAddr
func (*EthernetInterface) MCastJoin ¶
func (e *EthernetInterface) MCastJoin(addr MACAddr) error
MCastJoin joins a multicast group
func (*EthernetInterface) NewConn ¶
func (e *EthernetInterface) NewConn(dest MACAddr) net.Conn
NewConn creates a new ethernet conn
func (*EthernetInterface) RecvPacket ¶
func (e *EthernetInterface) RecvPacket() (pkt []byte, src MACAddr, err error)
func (*EthernetInterface) SendPacket ¶
func (e *EthernetInterface) SendPacket(dst MACAddr, pkt []byte) error
SendPacket sends an 802.3 ethernet packet (LLC)
type EthernetInterfaceFactory ¶
type EthernetInterfaceFactory struct{}
func NewEthernetInterfaceFactory ¶
func NewEthernetInterfaceFactory() *EthernetInterfaceFactory
func (*EthernetInterfaceFactory) New ¶
func (eif *EthernetInterfaceFactory) New(name string, bpf *BPF, protocol uint16) (EthernetInterfaceI, error)
type EthernetInterfaceFactoryI ¶
type EthernetInterfaceFactoryI interface {
New(name string, bpf *BPF, protocol uint16) (EthernetInterfaceI, error)
}
type EthernetInterfaceI ¶
type MockEthernetInterface ¶
type MockEthernetInterface struct {
// contains filtered or unexported fields
}
func NewMockEthernetInterface ¶
func NewMockEthernetInterface() *MockEthernetInterface
func (*MockEthernetInterface) Close ¶
func (mei *MockEthernetInterface) Close()
func (*MockEthernetInterface) DrainBuffer ¶
func (mei *MockEthernetInterface) DrainBuffer()
func (*MockEthernetInterface) GetMTU ¶
func (mei *MockEthernetInterface) GetMTU() int
func (*MockEthernetInterface) MCastJoin ¶
func (mei *MockEthernetInterface) MCastJoin(addr MACAddr) error
func (*MockEthernetInterface) ReceiveAtRemote ¶
func (mei *MockEthernetInterface) ReceiveAtRemote() (MACAddr, []byte)
func (*MockEthernetInterface) RecvPacket ¶
func (mei *MockEthernetInterface) RecvPacket() (pkt []byte, src MACAddr, err error)
func (*MockEthernetInterface) SendFromRemote ¶
func (mei *MockEthernetInterface) SendFromRemote(src MACAddr, pkt []byte)
func (*MockEthernetInterface) SendPacket ¶
func (mei *MockEthernetInterface) SendPacket(dst MACAddr, pkt []byte) error
type MockEthernetInterfaceFactory ¶
type MockEthernetInterfaceFactory struct{}
func NewMockEthernetInterfaceFactory ¶
func NewMockEthernetInterfaceFactory() *MockEthernetInterfaceFactory
func (*MockEthernetInterfaceFactory) New ¶
func (meif *MockEthernetInterfaceFactory) New(name string, bpf *BPF) (EthernetInterfaceI, error)
Click to show internal directories.
Click to hide internal directories.