isProxySocketError checks if the error indicates the proxy socket is unavailable. This includes: - "no such file or directory" - socket file was deleted - "connection refused" - socket exists but nothing is listening - "dial unix" errors - general Unix socket connection failures
(err error)
| 141 | // - "connection refused" - socket exists but nothing is listening |
| 142 | // - "dial unix" errors - general Unix socket connection failures |
| 143 | func isProxySocketError(err error) bool { |
| 144 | if err == nil { |
| 145 | return false |
| 146 | } |
| 147 | |
| 148 | errStr := strings.ToLower(err.Error()) |
| 149 | |
| 150 | // Check for common proxy socket failure patterns |
| 151 | proxyErrorPatterns := []string{ |
| 152 | "no such file or directory", // Socket file deleted |
| 153 | "connect: connection refused", // Socket exists but no listener |
| 154 | "proxyconnect tcp", // Proxy connection failure |
| 155 | "dial unix", // Unix socket dial failure |
| 156 | "unix socket", // Generic Unix socket error |
| 157 | } |
| 158 | |
| 159 | for _, pattern := range proxyErrorPatterns { |
| 160 | if strings.Contains(errStr, pattern) { |
| 161 | return true |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | return false |
| 166 | } |