handler.go 681 B

123456789101112131415161718
  1. // Package handler holds the interface that backends implement, handlers take in, and the top level dhcpServer package passes to handlers.
  2. package handler
  3. import (
  4. "context"
  5. "dhcp/internal/dhcpServer/data"
  6. "net"
  7. )
  8. // BackendReader is the interface for getting data from a macAndIPXE.
  9. //
  10. // Backends implement this interface to provide dhcpServer and Netboot data to the handlers.
  11. type BackendReader interface {
  12. // Read data (from a macAndIPXE) based on a mac address
  13. // and return dhcpServer headers and options, including netboot info.
  14. GetByMac(context.Context, net.HardwareAddr, string) (*data.DHCP, error)
  15. GetByIP(context.Context, net.IP, string) (*data.DHCP, error)
  16. }