package dhcp import ( "net/netip" "git.wntrmute.dev/kyle/kdhcp/leases" ) func NewOffer(request *Packet, server *leases.Server, lease *leases.Info) (offer *Packet, err error) { packet := &Packet{ MessageType: MessageTypeBootResponse, HardwareType: request.HardwareType, HardwareAddress: request.HardwareAddress, Hops: 0, TransactionID: request.TransactionID, SecondsElapsed: 0, Flags: request.Flags, ServerName: "", FileName: "", ClientIP: request.ClientIP, YourIP: lease.Addr, NextIP: netip.IPv4Unspecified(), RelayIP: netip.IPv4Unspecified(), DHCPType: DHCPMessageTypeOffer, HostName: "", ClientID: request.ClientID, Parameters: []Parameter{}, } packet.AddParameter(ParameterDNS(server.Network.DNS)) packet.AddParameter(ParameterHostName(lease.HostName)) packet.AddParameter(ParameterRouter(server.Network.Gateway)) packet.AddParameter(ParameterSubnetMask(server.Network.Mask)) return packet, nil }