feat: 代理调试版本

This commit is contained in:
tbphp
2025-07-11 14:01:54 +08:00
parent 395d48c3e7
commit 6ffbb7e9a1
13 changed files with 568 additions and 255 deletions

View File

@@ -0,0 +1,31 @@
package errors
import (
"strings"
)
// ignorableErrorSubstrings contains a list of substrings that indicate an error
// can be safely ignored. These typically occur when a client disconnects prematurely.
var ignorableErrorSubstrings = []string{
"context canceled",
"connection reset by peer",
"broken pipe",
"use of closed network connection",
"request canceled",
}
// IsIgnorableError checks if the given error is a common, non-critical error
// that can occur when a client disconnects. This is used to prevent logging
// unnecessary errors and to avoid marking keys as failed for client-side issues.
func IsIgnorableError(err error) bool {
if err == nil {
return false
}
errStr := err.Error()
for _, sub := range ignorableErrorSubstrings {
if strings.Contains(errStr, sub) {
return true
}
}
return false
}