DnsLibs
DnsLibs copied to clipboard
Improve the upstream testing helper
For now, we have 2 issues with the helper (ag::err_string ag::test_upstream(...)
):
- it returns the optional error string as the result of the test
- it does both the validation of an upstream URL and testing if it is alive
To address these issues the following should be done:
- add an enum with a few error codes, like OK, INVALID_ADDRESS, and NETWORK_ERROR (maybe something else), and make the helper return the error code
- there are 2 options:
- add some parameter to the helper which identifies if the health check is needed, or
- extract the validation logic to a separate method