diff --git a/internal/logging/accesslog/access_logger.go b/internal/logging/accesslog/access_logger.go index 13a8b4d0..ecae79c4 100644 --- a/internal/logging/accesslog/access_logger.go +++ b/internal/logging/accesslog/access_logger.go @@ -76,7 +76,7 @@ const ( errBurst = 5 ) -var lineBufPool = synk.NewBytesPool() +var lineBufPool = synk.GetBytesPool() func NewAccessLogger(parent task.Parent, cfg AnyConfig) (*AccessLogger, error) { io, err := cfg.IO() diff --git a/internal/logging/accesslog/rotate.go b/internal/logging/accesslog/rotate.go index 52d91715..b472e252 100644 --- a/internal/logging/accesslog/rotate.go +++ b/internal/logging/accesslog/rotate.go @@ -66,7 +66,7 @@ type lineInfo struct { Size int64 // Size of this line } -var rotateBytePool = synk.NewBytesPool() +var rotateBytePool = synk.GetBytesPool() // rotateLogFile rotates the log file based on the retention policy. // It returns the result of the rotation and an error if any. diff --git a/internal/metrics/systeminfo/json.go b/internal/metrics/systeminfo/json.go index 9898fc83..9b640677 100644 --- a/internal/metrics/systeminfo/json.go +++ b/internal/metrics/systeminfo/json.go @@ -9,7 +9,7 @@ import ( "github.com/yusing/go-proxy/internal/utils/synk" ) -var bufPool = synk.NewBytesPool() +var bufPool = synk.GetBytesPool() // explicitly implement MarshalJSON to avoid reflection. func (s *SystemInfo) MarshalJSON() ([]byte, error) { diff --git a/internal/net/gphttp/middleware/modify_html.go b/internal/net/gphttp/middleware/modify_html.go index 259d15be..9beaf09e 100644 --- a/internal/net/gphttp/middleware/modify_html.go +++ b/internal/net/gphttp/middleware/modify_html.go @@ -21,7 +21,7 @@ type modifyHTML struct { var ModifyHTML = NewMiddleware[modifyHTML]() -var bytePool = synk.NewBytesPool() +var bytePool = synk.GetBytesPool() func (m *modifyHTML) before(_ http.ResponseWriter, req *http.Request) bool { req.Header.Set("Accept-Encoding", "") diff --git a/internal/route/stream/udp_udp.go b/internal/route/stream/udp_udp.go index 8734c94c..4e7a98b9 100644 --- a/internal/route/stream/udp_udp.go +++ b/internal/route/stream/udp_udp.go @@ -47,7 +47,7 @@ const ( udpReadTimeout = 30 * time.Second ) -var bufPool = synk.NewBytesPool() +var bufPool = synk.GetBytesPool() func NewUDPUDPStream(listenAddr, dstAddr string) (nettypes.Stream, error) { dst, err := net.ResolveUDPAddr("udp", dstAddr)