NewFileWatcherCRLProvider returns a new instance of the FileWatcherCRLProvider. It uses FileWatcherOptions to validate and apply configuration required for creating a new instance. The initial scan of CRLDirectory is performed inside this function. Users should call Close to stop the background refr
(o FileWatcherOptions)
| 113 | // CRLDirectory is performed inside this function. Users should call Close to |
| 114 | // stop the background refresh of CRLDirectory. |
| 115 | func NewFileWatcherCRLProvider(o FileWatcherOptions) (*FileWatcherCRLProvider, error) { |
| 116 | if err := o.validate(); err != nil { |
| 117 | return nil, err |
| 118 | } |
| 119 | provider := &FileWatcherCRLProvider{ |
| 120 | crls: make(map[string]*CRL), |
| 121 | opts: o, |
| 122 | stop: make(chan struct{}), |
| 123 | done: make(chan struct{}), |
| 124 | } |
| 125 | provider.scanCRLDirectory() |
| 126 | go provider.run() |
| 127 | return provider, nil |
| 128 | } |
| 129 | |
| 130 | func (o *FileWatcherOptions) validate() error { |
| 131 | // Checks relates to CRLDirectory. |