Documentation ¶
Overview ¶
Package raw enables reading and writing data at the device driver level for a network interface.
Index ¶
- Variables
- type Addr
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) ReadFrom(b []byte) (int, net.Addr, error)
- func (c *Conn) ReadMsg(b, oob []byte) (int, int, int, net.Addr, error)
- func (c *Conn) SetBPF(filter []bpf.RawInstruction) error
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetPacketAuxdata() error
- func (c *Conn) SetPromiscuous(b bool) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) WriteTo(b []byte, addr net.Addr) (int, error)
- type Protocol
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotImplemented is returned when certain functionality is not yet // implemented for the host operating system. ErrNotImplemented = errors.New("raw: not implemented") )
Functions ¶
This section is empty.
Types ¶
type Addr ¶
type Addr struct {
HardwareAddr net.HardwareAddr
}
Addr is a network address which can be used to contact other machines, using their hardware addresses.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is an implementation of the net.PacketConn interface which can send and receive data at the network interface device driver level.
func ListenPacket ¶
ListenPacket creates a net.PacketConn which can be used to send and receive data at the network interface device driver level.
ifi specifies the network interface which will be used to send and receive data. proto specifies the protocol which should be captured and transmitted. proto, if needed, is automatically converted to network byte order (big endian), akin to the htons() function in C.
func (*Conn) SetBPF ¶
func (c *Conn) SetBPF(filter []bpf.RawInstruction) error
SetBPF attaches an assembled BPF program to the connection.
func (*Conn) SetDeadline ¶
SetDeadline implements the net.PacketConn SetDeadline method.
func (*Conn) SetPacketAuxdata ¶
func (*Conn) SetPromiscuous ¶
SetPromiscuous enables or disables promiscuous mode on the interface, allowing it to receive traffic that is not addressed to the interface.
func (*Conn) SetReadDeadline ¶
SetReadDeadline implements the net.PacketConn SetReadDeadline method.
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline implements the net.PacketConn SetWriteDeadline method.