Check performs checks using c according to its configuration. An error is only returned if there is a configuration error.
()
| 55 | // Check performs checks using c according to its configuration. |
| 56 | // An error is only returned if there is a configuration error. |
| 57 | func (c Checker) Check() (types.Result, error) { |
| 58 | if c.Attempts < 1 { |
| 59 | c.Attempts = 1 |
| 60 | } |
| 61 | |
| 62 | result := types.NewResult() |
| 63 | result.Title = c.Name |
| 64 | result.Endpoint = c.URL |
| 65 | result.Times = c.doChecks() |
| 66 | |
| 67 | return c.conclude(result), nil |
| 68 | } |
| 69 | |
| 70 | // New creates a new Checker instance based on json config |
| 71 | func New(config json.RawMessage) (Checker, error) { |