refactor: improve error handling and response formatting in API

This commit is contained in:
yusing
2025-05-03 17:41:10 +08:00
parent 82c829de18
commit 98e90d7a0b
31 changed files with 657 additions and 185 deletions

View File

@@ -5,8 +5,6 @@ import (
"math"
"strconv"
"time"
"github.com/yusing/go-proxy/internal/utils/strutils/ansi"
)
// AppendDuration appends a duration to a buffer with the following format:
@@ -215,13 +213,6 @@ func AppendByteSize[T ~int | ~uint | ~int64 | ~uint64 | ~float64](size T, buf []
return buf
}
func DoYouMean(s string) string {
if s == "" {
return ""
}
return "Did you mean " + ansi.Info(s) + "?"
}
func Pluralize(n int64) string {
if n > 1 {
return "s"