()
| 128 | } |
| 129 | |
| 130 | func (o *FileWatcherOptions) validate() error { |
| 131 | // Checks relates to CRLDirectory. |
| 132 | if o.CRLDirectory == "" { |
| 133 | return fmt.Errorf("advancedtls: CRLDirectory needs to be specified") |
| 134 | } |
| 135 | if _, err := os.ReadDir(o.CRLDirectory); err != nil { |
| 136 | return fmt.Errorf("advancedtls: CRLDirectory %v is not readable: %v", o.CRLDirectory, err) |
| 137 | } |
| 138 | // Checks related to RefreshDuration. |
| 139 | if o.RefreshDuration == 0 { |
| 140 | o.RefreshDuration = defaultCRLRefreshDuration |
| 141 | } |
| 142 | if o.RefreshDuration < minCRLRefreshDuration { |
| 143 | grpclogLogger.Warningf("RefreshDuration must be at least 1 minute: provided value %v, minimum value %v will be used.", o.RefreshDuration, minCRLRefreshDuration) |
| 144 | o.RefreshDuration = minCRLRefreshDuration |
| 145 | } |
| 146 | return nil |
| 147 | } |
| 148 | |
| 149 | // Start starts watching the directory for CRL files and updates the provider accordingly. |
| 150 | func (p *FileWatcherCRLProvider) run() { |
no test coverage detected