From 18aa1f1eff99794ff19a0d85680f3f2d496c677b Mon Sep 17 00:00:00 2001 From: WendelHime <6754291+WendelHime@users.noreply.github.com> Date: Mon, 4 Nov 2024 11:36:06 -0300 Subject: [PATCH] fix: add comment explaining about both err handling approaches --- fronted.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fronted.go b/fronted.go index af1781f..37299f7 100644 --- a/fronted.go +++ b/fronted.go @@ -399,11 +399,12 @@ func (f *fronted) doDial(m MasqueradeInterface) (conn net.Conn, retriable bool, func isNetworkUnreachable(err error) bool { var opErr *net.OpError if errors.As(err, &opErr) { + // The following error verifications look for errors that generally happen at Linux/Unix devices if errors.Is(opErr.Err, syscall.ENETUNREACH) || errors.Is(opErr.Err, syscall.EHOSTUNREACH) { return true } - // Fallback to message-based checking (works for Windows and Unix-like systems) + // The string verification errors use a broader approach with errors from windows and also linux/unix devices errMsg := opErr.Err.Error() if strings.Contains(errMsg, "network is unreachable") || strings.Contains(errMsg, "no route to host") ||