code: func (c *Client) DiscoverOffer() (*dhcp4.Packet, error) {
  	ctx, cancel := context.WithCancel(context.Background())
  	wg, out, errCh := c.SimpleSendAndRead(ctx, DefaultServers, c.DiscoverPacket())
  	defer func() {
  		// Explicitly cancel first, then wait.
  		cancel()
  		wg.Wait()
  	}()
  
  	for packet := range out {
  		msgType := dhcp4opts.GetDHCPMessageType(packet.Packet.Options)
  		if msgType == dhcp4opts.DHCPOffer {
  			// Deferred cancel will cancel the goroutine.
  			return packet.Packet, nil
  		}
  	}
  
  	if err, ok := <-errCh; ok && err != nil {
  		return nil, err
  	}
  	return nil, fmt.Errorf("didn't get a packet")
  }
docs: // DiscoverOffer sends a DHCPDiscover message and returns the first valid offer
  // received.