(interval time.Duration)
| 109 | } |
| 110 | |
| 111 | func (auth *BasicAuth) reloadLoop(interval time.Duration) { |
| 112 | ticker := time.NewTicker(interval) |
| 113 | defer ticker.Stop() |
| 114 | for { |
| 115 | select { |
| 116 | case <-auth.stopChan: |
| 117 | return |
| 118 | case <-ticker.C: |
| 119 | if err := auth.reload(); err != nil { |
| 120 | auth.logger.Error("reload failed: %v", err) |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | func (auth *BasicAuth) Valid(user, password, userAddr string) bool { |
| 127 | pwFile := auth.pw.Load().file |
no test coverage detected