mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-05-27 12:52:27 +02:00
cmd/cli: handle general failure better during self check
After installing as a system service, "ctrld start" does an end-to-end test for ensuring DNS can be resolved correctly. However, in case the system is mis-configured (by firewall, other softwares ...) and the test query could not be sent to ctrld listener, the current error message is not helpful, causing the confusion from users perspective. To improve this, selfCheckStatus function now returns the actual status and error during its process. The caller can now rely on the service status and the error to produce more useful/friendly message to users.
This commit is contained in:
committed by
Cuong Manh Le
parent
faa0ed06b6
commit
176c22f229
@@ -586,6 +586,15 @@ func errNetworkError(err error) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// errConnectionRefused reports whether err is connection refused.
|
||||
func errConnectionRefused(err error) bool {
|
||||
var opErr *net.OpError
|
||||
if !errors.As(err, &opErr) {
|
||||
return false
|
||||
}
|
||||
return errors.Is(opErr.Err, syscall.ECONNREFUSED) || errors.Is(opErr.Err, windowsECONNREFUSED)
|
||||
}
|
||||
|
||||
func ifaceFirstPrivateIP(iface *net.Interface) string {
|
||||
if iface == nil {
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user