Add direct copy

This commit is contained in:
世界 2023-04-24 18:45:38 +08:00
parent 44534566a3
commit bf0aaacc67
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
15 changed files with 912 additions and 136 deletions

View file

@ -186,13 +186,16 @@ func (c *CachedPacketConn) ReadPacket(buffer *buf.Buffer) (destination M.Socksad
return c.PacketConn.ReadPacket(buffer)
}
func (c *CachedPacketConn) ReadCachedPacket() (destination M.Socksaddr, buffer *buf.Buffer) {
buffer = c.buffer
func (c *CachedPacketConn) ReadCachedPacket() *N.PacketBuffer {
buffer := c.buffer
c.buffer = nil
if buffer != nil {
buffer.DecRef()
}
return c.destination, buffer
return &N.PacketBuffer{
Buffer: buffer,
Destination: c.destination,
}
}
func (c *CachedPacketConn) Upstream() any {