Improve: recycle buffer after packet used

This commit is contained in:
Dreamacro
2020-04-16 18:19:36 +08:00
parent 2750c7ead0
commit 1825535abd
6 changed files with 27 additions and 29 deletions

View File

@ -135,8 +135,8 @@ type UDPPacket interface {
// this is important when using Fake-IP.
WriteBack(b []byte, addr net.Addr) (n int, err error)
// Close closes the underlaying connection.
Close() error
// Drop call after packet is used, could recycle buffer in this function.
Drop()
// LocalAddr returns the source IP/Port of packet
LocalAddr() net.Addr