// Package data is an interface between DHCP macAndIPXE implementations and the DHCP server. package data import ( "github.com/insomniacslk/dhcp/dhcpv4" "net" "net/netip" ) // Packet holds the data that is passed to a DHCP handler. type Packet struct { // Peer is the address of the client that sent the DHCP message. Peer net.Addr // Pkt is the DHCP message. Pkt *dhcpv4.DHCPv4 // Md is the metadata that was passed to the DHCP server. Md *Metadata } // Metadata holds metadata about the DHCP packet that was received. type Metadata struct { // IfName is the name of the interface that the DHCP message was received on. IfName string // IfIndex is the index of the interface that the DHCP message was received on. IfIndex int } // DHCP holds the DHCP headers and options to be set in a DHCP handler response. // This is the API between a DHCP handler and a macAndIPXE. type DHCP struct { MACAddress net.HardwareAddr // chaddr DHCP header. IPAddress netip.Addr // yiaddr DHCP header. SubnetMask net.IPMask // DHCP option 1. DefaultGateway netip.Addr // DHCP option 3. NameServers []net.IP // DHCP option 6. DomainName string // DHCP option 15. BroadcastAddress netip.Addr // DHCP option 28. NTPServers []net.IP // DHCP option 42. VLANID string // DHCP option 43.116. LeaseTime uint32 // DHCP option 51. DomainSearch []string // DHCP option 119. ServerIP net.IP // DHCP option 54. }