code: func (a *Agent) ShutdownEndpoints() {
  	a.shutdownLock.Lock()
  	defer a.shutdownLock.Unlock()
  
  	if len(a.dnsServers) == 0 && len(a.httpServers) == 0 {
  		return
  	}
  
  	for _, srv := range a.dnsServers {
  		a.logger.Printf("[INFO] agent: Stopping DNS server %s (%s)", srv.Server.Addr, srv.Server.Net)
  		srv.Shutdown()
  	}
  	a.dnsServers = nil
  
  	for _, srv := range a.httpServers {
  		a.logger.Printf("[INFO] agent: Stopping %s server %s (%s)", strings.ToUpper(srv.proto), srv.ln.Addr().String(), srv.ln.Addr().Network())
  		ctx, cancel := context.WithTimeout(context.Background(), time.Second)
  		defer cancel()
  		srv.Shutdown(ctx)
  		if ctx.Err() == context.DeadlineExceeded {
  			a.logger.Printf("[WARN] agent: Timeout stopping %s server %s (%s)", strings.ToUpper(srv.proto), srv.ln.Addr().String(), srv.ln.Addr().Network())
  		}
  	}
  	a.httpServers = nil
  
  	a.logger.Println("[INFO] agent: Waiting for endpoints to shut down")
  	a.wgServers.Wait()
  	a.logger.Print("[INFO] agent: Endpoints down")
  }
docs: // ShutdownEndpoints terminates the HTTP and DNS servers. Should be
  // preceded by ShutdownAgent.