fix: gvisor stack's dns hijack not working

This commit is contained in:
wwqgtxx 2023-12-08 10:13:08 +08:00
parent b538aa6ca2
commit fdc9c01df1

View file

@ -149,6 +149,7 @@ func (h *ListenerHandler) NewPacketConnection(ctx context.Context, conn network.
defer cancel() defer cancel()
inData := readBuff.Bytes() inData := readBuff.Bytes()
writeBuff := readBuff writeBuff := readBuff
writeBuff.Resize(writeBuff.Start(), 0)
if writeBuff.Cap() < rwOptions.MTU { // only create a new buffer when space don't enough if writeBuff.Cap() < rwOptions.MTU { // only create a new buffer when space don't enough
writeBuff = rwOptions.NewPacketBuffer() writeBuff = rwOptions.NewPacketBuffer()
} }