From 30fbafd9546cd816eed4c39f399afe86a6b2d2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Mon, 18 Nov 2024 12:14:35 +0800 Subject: [PATCH] udpnat2: Add cache funcs --- common/udpnat2/service.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/common/udpnat2/service.go b/common/udpnat2/service.go index e06cebc..4bbef75 100644 --- a/common/udpnat2/service.go +++ b/common/udpnat2/service.go @@ -98,6 +98,20 @@ func (s *Service) NewPacket(bufferSlices [][]byte, source M.Socksaddr, destinati } } +func (s *Service) Purge() { + s.cache.Purge() +} + +func (s *Service) PurgeExpired() { + s.cache.PurgeExpired() +} + func (s *Service) Metrics() Metrics { return s.metrics } + +func (s *Service) ResetMetrics() Metrics { + metrics := s.metrics + s.metrics = Metrics{} + return metrics +}