add printer helper func
package cmd
import (
+ "context"
"crypto/tls"
"crypto/x509"
"errors"
@@ -206,3 +207,14 @@ func loadCerts() ([]tls.Certificate, *x509.CertPool, error) {
return []tls.Certificate{certificate}, certPool, nil
}
+
+func printer(ctx context.Context, c chan string) {
+ for {
+ select {
+ case m := <-c:
+ fmt.Println(m)
+ case <-ctx.Done():
+ return
+ }
+ }
+}
