diff --git a/tun_linux.go b/tun_linux.go index f35921e..8e1e5d5 100644 --- a/tun_linux.go +++ b/tun_linux.go @@ -17,7 +17,6 @@ import ( "github.com/sagernet/sing-tun/internal/gtcpip/checksum" "github.com/sagernet/sing-tun/internal/gtcpip/header" "github.com/sagernet/sing/common" - "github.com/sagernet/sing/common/buf" "github.com/sagernet/sing/common/control" E "github.com/sagernet/sing/common/exceptions" "github.com/sagernet/sing/common/rw" @@ -393,10 +392,7 @@ func handleVirtioRead(in []byte, bufs [][]byte, sizes []int, offset int) (int, e func (t *NativeTun) Write(p []byte) (n int, err error) { if t.vnetHdr { - buffer := buf.Get(virtioNetHdrLen + len(p)) - copy(buffer[virtioNetHdrLen:], p) - _, err = t.BatchWrite([][]byte{buffer}, virtioNetHdrLen) - buf.Put(buffer) + _, err = t.BatchWrite([][]byte{p}, virtioNetHdrLen) if err != nil { return }