mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
fix: dns tcp hijack not working
This commit is contained in:
parent
e4138c3e1e
commit
347e5e9606
@ -4,6 +4,7 @@ package gvisor
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"io"
|
||||
"net"
|
||||
"net/netip"
|
||||
"time"
|
||||
@ -60,7 +61,7 @@ func (gh *gvHandler) HandleTCP(tunConn adapter.TCPConn) {
|
||||
break
|
||||
}
|
||||
|
||||
n, err := tunConn.Read(buf[:length])
|
||||
n, err := io.ReadFull(tunConn, buf[:length])
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
@ -70,6 +71,11 @@ func (gh *gvHandler) HandleTCP(tunConn adapter.TCPConn) {
|
||||
break
|
||||
}
|
||||
|
||||
err = binary.Write(tunConn, binary.BigEndian, uint16(len(msg)))
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
|
||||
_, _ = tunConn.Write(msg)
|
||||
}
|
||||
}()
|
||||
|
@ -113,7 +113,7 @@ func New(device device.Device, dnsHijack []netip.AddrPort, tunAddress netip.Pref
|
||||
break
|
||||
}
|
||||
|
||||
n, err := conn.Read(buf[:length])
|
||||
n, err := io.ReadFull(conn, buf[:length])
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
@ -123,6 +123,11 @@ func New(device device.Device, dnsHijack []netip.AddrPort, tunAddress netip.Pref
|
||||
break
|
||||
}
|
||||
|
||||
err = binary.Write(conn, binary.BigEndian, uint16(len(msg)))
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
|
||||
_, _ = conn.Write(msg)
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user