Documentation ¶
Index ¶
- func ListenDHCP(l log.Logger, ip net.IP, iface *net.Interface) (net.PacketConn, error)
- func PreparePacket(srcMAC net.HardwareAddr, srcIP net.IP, dstMAC net.HardwareAddr, dstIP net.IP, ...) ([]byte, error)
- type Addr
- type DHCPConn
- func (p *DHCPConn) Close() error
- func (p *DHCPConn) LocalAddr() net.Addr
- func (p *DHCPConn) ReadFrom(b []byte) (int, net.Addr, error)
- func (p *DHCPConn) SetDeadline(t time.Time) error
- func (p *DHCPConn) SetReadDeadline(t time.Time) error
- func (p *DHCPConn) SetWriteDeadline(t time.Time) error
- func (p *DHCPConn) WriteTo(b []byte, addr net.Addr) (int, error)
- type RawAddr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenDHCP ¶
ListenDHCP starts listening for DHCP requests on the given IP and interface It opens a UDP and a AF_PACKET socket for communication
func PreparePacket ¶
func PreparePacket(srcMAC net.HardwareAddr, srcIP net.IP, dstMAC net.HardwareAddr, dstIP net.IP, payload []byte) ([]byte, error)
PreparePacket prepares a raw UDP network packet including Ethernet, IP and UDP layers
Types ¶
type Addr ¶
Addr is a IPv4 address used to send directed unicasts (i.e. without a prior ARP request). The IP datagram will be sent to the provided MAC address without taking routing considerations into account!
type DHCPConn ¶
type DHCPConn struct {
// contains filtered or unexported fields
}
DHCPConn implements net.PacketConn but utilizes a standard UDP and and AF_PACKET socket
func (*DHCPConn) Close ¶
Close will close both the UDP and the AF_PACKET socket and will return the first error encountered
func (*DHCPConn) LocalAddr ¶
LocalAddr implements the PacketConn interface and returns the local address of the UDP socket
func (*DHCPConn) ReadFrom ¶
ReadFrom implements the PacketConn interface and calls ReadFrom on the underlying AF_PACKET socket
func (*DHCPConn) SetDeadline ¶
SetDeadline implements the PacketConn interface but is not yet implemented
func (*DHCPConn) SetReadDeadline ¶
SetReadDeadline implements the PacketConn interface
func (*DHCPConn) SetWriteDeadline ¶
SetWriteDeadline implements the PacketConn interface