github.com/letsencrypt/boulder@v0.20251208.0/observer/observer.go (about)

     1  package observer
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/letsencrypt/boulder/cmd"
     7  	blog "github.com/letsencrypt/boulder/log"
     8  	_ "github.com/letsencrypt/boulder/observer/probers/crl"
     9  	_ "github.com/letsencrypt/boulder/observer/probers/dns"
    10  	_ "github.com/letsencrypt/boulder/observer/probers/http"
    11  	_ "github.com/letsencrypt/boulder/observer/probers/tcp"
    12  	_ "github.com/letsencrypt/boulder/observer/probers/tls"
    13  )
    14  
    15  // Observer is the steward of goroutines started for each `monitor`.
    16  type Observer struct {
    17  	logger   blog.Logger
    18  	monitors []*monitor
    19  	shutdown func(ctx context.Context)
    20  }
    21  
    22  // Start spins off a goroutine for each monitor, and waits for a signal to exit
    23  func (o Observer) Start() {
    24  	for _, mon := range o.monitors {
    25  		go mon.start(o.logger)
    26  	}
    27  
    28  	defer o.shutdown(context.Background())
    29  	cmd.WaitForSignal()
    30  }