diff --git a/pkg/udpproxy/session.go b/pkg/udpproxy/session.go index b802742..2d5b2b5 100644 --- a/pkg/udpproxy/session.go +++ b/pkg/udpproxy/session.go @@ -38,8 +38,8 @@ func newSession(caddr *net.UDPAddr, raddr *net.UDPAddr, proxyConn *net.UDPConn) } func (s *session) listen() error { + buf := make([]byte, 2048) for { - buf := make([]byte, 2048) n, err := s.serverConn.Read(buf) if err != nil { log.Error(err) diff --git a/pkg/udpproxy/udpproxy.go b/pkg/udpproxy/udpproxy.go index f2e66c9..6437da9 100644 --- a/pkg/udpproxy/udpproxy.go +++ b/pkg/udpproxy/udpproxy.go @@ -46,8 +46,8 @@ func (c *Client) ListenAndServe() error { go c.pruneSessions() + buf := make([]byte, 2048) for { - buf := make([]byte, 2048) n, caddr, err := c.proxyConn.ReadFromUDP(buf) if err != nil { log.Error(err)