From c0bcf77bf745cf9acd84937b4dc6a4acb85b0eb6 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Mon, 3 Apr 2023 21:07:52 +0800 Subject: [PATCH] fix: tuic fast-open not work --- transport/tuic/client.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/transport/tuic/client.go b/transport/tuic/client.go index 4932dc9b..af00da03 100644 --- a/transport/tuic/client.go +++ b/transport/tuic/client.go @@ -12,6 +12,7 @@ import ( "sync/atomic" "time" + "github.com/Dreamacro/clash/common/buf" N "github.com/Dreamacro/clash/common/net" "github.com/Dreamacro/clash/common/pool" C "github.com/Dreamacro/clash/constant" @@ -338,6 +339,14 @@ func (conn *earlyConn) Read(b []byte) (n int, err error) { return conn.BufferedConn.Read(b) } +func (conn *earlyConn) ReadBuffer(buffer *buf.Buffer) (err error) { + err = conn.Response() + if err != nil { + return err + } + return conn.BufferedConn.ReadBuffer(buffer) +} + func (t *clientImpl) ListenPacketWithDialer(ctx context.Context, metadata *C.Metadata, dialer C.Dialer, dialFn DialFunc) (net.PacketConn, error) { quicConn, err := t.getQuicConn(ctx, dialer, dialFn) if err != nil {