// makeBundle opens the file for writing, and listens for incoming
// certificates. These are PEM-encoded and written to file.
makeBundle opens the file for writing, and listens for incoming
certificates. These are PEM-encoded and written to file.
// makeBundle opens the file for writing and listens for incoming // certificates . These are PEM - encoded and written to file .
func makeBundle(filename string, bundler chan *x509.Certificate) {
	file, err := os.Create(filename)
	if err != nil {
		log.Errorf("%v", err)
		return
	}
	defer file.Close()
	var total int
	for {
		cert, ok := <-bundler
		if !ok {
			break
		}
		block := &pem.Block{
			Type:  "CERTIFICATE",
			Bytes: cert.Raw,
		}
		err = pem.Encode(file, block)
		if err != nil {
			log.Errorf("Failed to write PEM block: %v", err)
			break
		}
		total++
	}
	log.Infof("Wrote %d certificates.", total)
}
func makeBundle ( filename string , bundler chan * x509 . Certificate ) { file , err := os . Create ( filename ) if err != nil { log . Errorf ( " " , err ) return } defer file . Close ( ) var total int for { cert , ok := <- bundler if ! ok { break } block := & pem . Block { Type : " " , Bytes : cert . Raw , } err = pem . Encode ( file , block ) if err != nil { log . Errorf ( " " , err ) break } total ++ } log . Infof ( " " , total ) }
makeBundle opens the file for writing, and listens for incoming
certificates.
makeBundle opens the file for writing and listens for incoming certificates .