code: func generatePrefixed(prefix string, count *int64, found chan<- result, stop <-chan struct{}) {
  	notBefore := time.Now()
  	notAfter := time.Date(2049, 12, 31, 23, 59, 59, 0, time.UTC)
  
  	template := x509.Certificate{
  		SerialNumber: new(big.Int).SetInt64(mr.Int63()),
  		Subject: pkix.Name{
  			CommonName: "syncthing",
  		},
  		NotBefore: notBefore,
  		NotAfter:  notAfter,
  
  		KeyUsage:              x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature,
  		ExtKeyUsage:           []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth, x509.ExtKeyUsageClientAuth},
  		BasicConstraintsValid: true,
  	}
  
  	priv, err := ecdsa.GenerateKey(elliptic.P384(), rand.Reader)
  	if err != nil {
  		fmt.Println(err)
  		os.Exit(1)
  	}
  
  	for {
  		select {
  		case <-stop:
  			return
  		default:
  		}
  
  		derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)
  		if err != nil {
  			fmt.Println(err)
  			os.Exit(1)
  		}
  
  		id := protocol.NewDeviceID(derBytes)
  		atomic.AddInt64(count, 1)
  
  		if strings.HasPrefix(id.String(), prefix) {
  			select {
  			case found <- result{id, priv, derBytes}:
  			case <-stop:
  			}
  			return
  		}
  	}
  }
docs: // Try certificates until one is found that has the prefix at the start of
  // the resulting device ID. Increments count atomically, sends the result to
  // found, returns when stop is closed.