Fix udp write back

This commit is contained in:
世界 2022-08-01 20:51:45 +08:00
parent 4a805410a2
commit 69bc471e19
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -56,6 +56,9 @@ type UDPBackWriter struct {
sourcePort uint16
}
func (w *UDPBackWriter) WriteIsThreadUnsafe() {
}
func (w *UDPBackWriter) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error {
defer buffer.Release()
@ -81,6 +84,7 @@ func (w *UDPBackWriter) WritePacket(buffer *buf.Buffer, destination M.Socksaddr)
packet := stack.NewPacketBuffer(stack.PacketBufferOptions{
ReserveHeaderBytes: header.UDPMinimumSize + int(route.MaxHeaderLength()),
Payload: gBuffer.NewWithData(buffer.Bytes()),
OnRelease: buffer.Release,
})
defer packet.DecRef()