Skip to content

Commit 56c3462

Browse files
committed
chore: update quic-go to 0.53.0
1 parent 6f4fe71 commit 56c3462

File tree

19 files changed

+69
-69
lines changed

19 files changed

+69
-69
lines changed

dns/doh.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@ func (doh *dnsOverHTTPS) createTransport(ctx context.Context) (t http.RoundTripp
447447
return transport, nil
448448
}
449449

450-
// http3Transport is a wrapper over *http3.RoundTripper that tries to optimize
450+
// http3Transport is a wrapper over *http3.Transport that tries to optimize
451451
// its behavior. The main thing that it does is trying to force use a single
452452
// connection to a host instead of creating a new one all the time. It also
453453
// helps mitigate race issues with quic-go.
454454
type http3Transport struct {
455-
baseTransport *http3.RoundTripper
455+
baseTransport *http3.Transport
456456

457457
closed bool
458458
mu sync.RWMutex
@@ -505,7 +505,7 @@ func (h *http3Transport) CloseIdleConnections() {
505505
// We should be able to fall back to H1/H2 in case if HTTP/3 is unavailable or
506506
// if it is too slow. In order to do that, this method will run two probes
507507
// in parallel (one for TLS, the other one for QUIC) and if QUIC is faster it
508-
// will create the *http3.RoundTripper instance.
508+
// will create the *http3.Transport instance.
509509
func (doh *dnsOverHTTPS) createTransportH3(
510510
ctx context.Context,
511511
tlsConfig *tls.Config,
@@ -519,7 +519,7 @@ func (doh *dnsOverHTTPS) createTransportH3(
519519
return nil, err
520520
}
521521

522-
rt := &http3.RoundTripper{
522+
rt := &http3.Transport{
523523
Dial: func(
524524
ctx context.Context,
525525

@@ -528,7 +528,7 @@ func (doh *dnsOverHTTPS) createTransportH3(
528528
_ string,
529529
tlsCfg *tlsC.Config,
530530
cfg *quic.Config,
531-
) (c quic.EarlyConnection, err error) {
531+
) (c *quic.Conn, err error) {
532532
return doh.dialQuic(ctx, addr, tlsCfg, cfg)
533533
},
534534
DisableCompression: true,
@@ -539,7 +539,7 @@ func (doh *dnsOverHTTPS) createTransportH3(
539539
return &http3Transport{baseTransport: rt}, nil
540540
}
541541

542-
func (doh *dnsOverHTTPS) dialQuic(ctx context.Context, addr string, tlsCfg *tlsC.Config, cfg *quic.Config) (quic.EarlyConnection, error) {
542+
func (doh *dnsOverHTTPS) dialQuic(ctx context.Context, addr string, tlsCfg *tlsC.Config, cfg *quic.Config) (*quic.Conn, error) {
543543
ip, port, err := net.SplitHostPort(addr)
544544
if err != nil {
545545
return nil, err

dns/doq.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ type dnsOverQUIC struct {
5353

5454
// conn is the current active QUIC connection. It can be closed and
5555
// re-opened when needed.
56-
conn quic.Connection
56+
conn *quic.Conn
5757
connMu sync.RWMutex
5858

5959
// bytesPool is a *sync.Pool we use to store byte buffers in. These byte
@@ -157,7 +157,7 @@ func (doq *dnsOverQUIC) ResetConnection() {
157157
// exchangeQUIC attempts to open a QUIC connection, send the DNS message
158158
// through it and return the response it got from the server.
159159
func (doq *dnsOverQUIC) exchangeQUIC(ctx context.Context, msg *D.Msg) (resp *D.Msg, err error) {
160-
var conn quic.Connection
160+
var conn *quic.Conn
161161
conn, err = doq.getConnection(ctx, true)
162162
if err != nil {
163163
return nil, err
@@ -169,7 +169,7 @@ func (doq *dnsOverQUIC) exchangeQUIC(ctx context.Context, msg *D.Msg) (resp *D.M
169169
return nil, fmt.Errorf("failed to pack DNS message for DoQ: %w", err)
170170
}
171171

172-
var stream quic.Stream
172+
var stream *quic.Stream
173173
stream, err = doq.openStream(ctx, conn)
174174
if err != nil {
175175
return nil, err
@@ -222,12 +222,12 @@ func (doq *dnsOverQUIC) getBytesPool() (pool *sync.Pool) {
222222
return doq.bytesPool
223223
}
224224

225-
// getConnection opens or returns an existing quic.Connection. useCached
225+
// getConnection opens or returns an existing *quic.Conn. useCached
226226
// argument controls whether we should try to use the existing cached
227227
// connection. If it is false, we will forcibly create a new connection and
228228
// close the existing one if needed.
229-
func (doq *dnsOverQUIC) getConnection(ctx context.Context, useCached bool) (quic.Connection, error) {
230-
var conn quic.Connection
229+
func (doq *dnsOverQUIC) getConnection(ctx context.Context, useCached bool) (*quic.Conn, error) {
230+
var conn *quic.Conn
231231
doq.connMu.RLock()
232232
conn = doq.conn
233233
if conn != nil && useCached {
@@ -282,7 +282,7 @@ func (doq *dnsOverQUIC) resetQUICConfig() {
282282
}
283283

284284
// openStream opens a new QUIC stream for the specified connection.
285-
func (doq *dnsOverQUIC) openStream(ctx context.Context, conn quic.Connection) (quic.Stream, error) {
285+
func (doq *dnsOverQUIC) openStream(ctx context.Context, conn *quic.Conn) (*quic.Stream, error) {
286286
ctx, cancel := context.WithCancel(ctx)
287287
defer cancel()
288288

@@ -302,7 +302,7 @@ func (doq *dnsOverQUIC) openStream(ctx context.Context, conn quic.Connection) (q
302302
}
303303

304304
// openConnection opens a new QUIC connection.
305-
func (doq *dnsOverQUIC) openConnection(ctx context.Context) (conn quic.Connection, err error) {
305+
func (doq *dnsOverQUIC) openConnection(ctx context.Context) (conn *quic.Conn, err error) {
306306
// we're using bootstrapped address instead of what's passed to the function
307307
// it does not create an actual connection, but it helps us determine
308308
// what IP is actually reachable (when there're v4/v6 addresses).
@@ -382,7 +382,7 @@ func (doq *dnsOverQUIC) closeConnWithError(err error) {
382382
}
383383

384384
// readMsg reads the incoming DNS message from the QUIC stream.
385-
func (doq *dnsOverQUIC) readMsg(stream quic.Stream) (m *D.Msg, err error) {
385+
func (doq *dnsOverQUIC) readMsg(stream *quic.Stream) (m *D.Msg, err error) {
386386
pool := doq.getBytesPool()
387387
bufPtr := pool.Get().(*[]byte)
388388

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ require (
2323
github.com/metacubex/chacha v0.1.5
2424
github.com/metacubex/fswatch v0.1.1
2525
github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759
26-
github.com/metacubex/quic-go v0.52.1-0.20250522021943-aef454b9e639
26+
github.com/metacubex/quic-go v0.53.1-0.20250628094454-fda5262d1d9c
2727
github.com/metacubex/randv2 v0.2.0
2828
github.com/metacubex/sing v0.5.4-0.20250605054047-54dc6097da29
2929
github.com/metacubex/sing-mux v0.3.2
30-
github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f
30+
github.com/metacubex/sing-quic v0.0.0-20250628100430-24f13f1e846e
3131
github.com/metacubex/sing-shadowsocks v0.2.11-0.20250621023810-0e9ef9dd0c92
3232
github.com/metacubex/sing-shadowsocks2 v0.2.5-0.20250621023950-93d605a2143d
3333
github.com/metacubex/sing-shadowtls v0.0.0-20250503063515-5d9f966d17a2

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,17 @@ github.com/metacubex/gvisor v0.0.0-20250324165734-5857f47bd43b h1:RUh4OdVPz/jDrM
112112
github.com/metacubex/gvisor v0.0.0-20250324165734-5857f47bd43b/go.mod h1:8LpS0IJW1VmWzUm3ylb0e2SK5QDm5lO/2qwWLZgRpBU=
113113
github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793 h1:1Qpuy+sU3DmyX9HwI+CrBT/oLNJngvBorR2RbajJcqo=
114114
github.com/metacubex/nftables v0.0.0-20250503052935-30a69ab87793/go.mod h1:RjRNb4G52yAgfR+Oe/kp9G4PJJ97Fnj89eY1BFO3YyA=
115-
github.com/metacubex/quic-go v0.52.1-0.20250522021943-aef454b9e639 h1:L+1brQNzBhCCxWlicwfK1TlceemCRmrDE4HmcVHc29w=
116-
github.com/metacubex/quic-go v0.52.1-0.20250522021943-aef454b9e639/go.mod h1:Kc6h++Q/zf3AxcUCevJhJwgrskJumv+pZdR8g/E/10k=
115+
github.com/metacubex/quic-go v0.53.1-0.20250628094454-fda5262d1d9c h1:ABQzmOaZddM3q0OYeoZEc0XF+KW+dUdPNvY/c5rsunI=
116+
github.com/metacubex/quic-go v0.53.1-0.20250628094454-fda5262d1d9c/go.mod h1:eWlAK3zsKI0P8UhYpXlIsl3mtW4D6MpMNuYLIu8CKWI=
117117
github.com/metacubex/randv2 v0.2.0 h1:uP38uBvV2SxYfLj53kuvAjbND4RUDfFJjwr4UigMiLs=
118118
github.com/metacubex/randv2 v0.2.0/go.mod h1:kFi2SzrQ5WuneuoLLCMkABtiBu6VRrMrWFqSPyj2cxY=
119119
github.com/metacubex/sing v0.5.2/go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w=
120120
github.com/metacubex/sing v0.5.4-0.20250605054047-54dc6097da29 h1:SD9q025FNTaepuFXFOKDhnGLVu6PQYChBvw2ZYPXeLo=
121121
github.com/metacubex/sing v0.5.4-0.20250605054047-54dc6097da29/go.mod h1:ypf0mjwlZm0sKdQSY+yQvmsbWa0hNPtkeqyRMGgoN+w=
122122
github.com/metacubex/sing-mux v0.3.2 h1:nJv52pyRivHcaZJKk2JgxpaVvj1GAXG81scSa9N7ncw=
123123
github.com/metacubex/sing-mux v0.3.2/go.mod h1:3rt1soewn0O6j89GCLmwAQFsq257u0jf2zQSPhTL3Bw=
124-
github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f h1:mP3vIm+9hRFI0C0Vl3pE0NESF/L85FDbuB0tGgUii6I=
125-
github.com/metacubex/sing-quic v0.0.0-20250523120938-f1a248e5ec7f/go.mod h1:JPTpf7fpnojsSuwRJExhSZSy63pVbp3VM39+zj+sAJM=
124+
github.com/metacubex/sing-quic v0.0.0-20250628100430-24f13f1e846e h1:vGl4pQTL/4wZJGQgMOwIInPyI5KwJ1NmFOLrHwORGo0=
125+
github.com/metacubex/sing-quic v0.0.0-20250628100430-24f13f1e846e/go.mod h1:B60FxaPHjR1SeQB0IiLrgwgvKsaoASfOWdiqhLjmMGA=
126126
github.com/metacubex/sing-shadowsocks v0.2.11-0.20250621023810-0e9ef9dd0c92 h1:Y9ebcKya6ow7VHoESCN5+l4zZvg5eaL2IhI5LLCQxQA=
127127
github.com/metacubex/sing-shadowsocks v0.2.11-0.20250621023810-0e9ef9dd0c92/go.mod h1:/squZ38pXrYjqtg8qn+joVvwbpGNYQNp8yxKsMVbCto=
128128
github.com/metacubex/sing-shadowsocks2 v0.2.5-0.20250621023950-93d605a2143d h1:Ey3A1tA8lVkRbK1FDmwuWj/57Nr8JMdpoVqe45mFzJg=

transport/hysteria/core/client.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type Client struct {
4141
tlsConfig *tlsC.Config
4242
quicConfig *quic.Config
4343

44-
quicSession quic.Connection
44+
quicSession *quic.Conn
4545
reconnectMutex sync.Mutex
4646
closed bool
4747

@@ -103,7 +103,7 @@ func (c *Client) connectToServer(dialer utils.PacketDialer) error {
103103
return nil
104104
}
105105

106-
func (c *Client) handleControlStream(qs quic.Connection, stream quic.Stream) (bool, string, error) {
106+
func (c *Client) handleControlStream(qs *quic.Conn, stream *quic.Stream) (bool, string, error) {
107107
// Send protocol version
108108
_, err := stream.Write([]byte{protocolVersion})
109109
if err != nil {
@@ -133,7 +133,7 @@ func (c *Client) handleControlStream(qs quic.Connection, stream quic.Stream) (bo
133133
return sh.OK, sh.Message, nil
134134
}
135135

136-
func (c *Client) handleMessage(qs quic.Connection) {
136+
func (c *Client) handleMessage(qs *quic.Conn) {
137137
for {
138138
msg, err := qs.ReceiveDatagram(context.Background())
139139
if err != nil {
@@ -162,7 +162,7 @@ func (c *Client) handleMessage(qs quic.Connection) {
162162
}
163163
}
164164

165-
func (c *Client) openStreamWithReconnect(dialer utils.PacketDialer) (quic.Connection, quic.Stream, error) {
165+
func (c *Client) openStreamWithReconnect(dialer utils.PacketDialer) (*quic.Conn, *wrappedQUICStream, error) {
166166
c.reconnectMutex.Lock()
167167
defer c.reconnectMutex.Unlock()
168168
if c.closed {
@@ -298,7 +298,7 @@ func (c *Client) Close() error {
298298
}
299299

300300
type quicConn struct {
301-
Orig quic.Stream
301+
Orig *wrappedQUICStream
302302
PseudoLocalAddr net.Addr
303303
PseudoRemoteAddr net.Addr
304304
Established bool
@@ -360,8 +360,8 @@ type UDPConn interface {
360360
}
361361

362362
type quicPktConn struct {
363-
Session quic.Connection
364-
Stream quic.Stream
363+
Session *quic.Conn
364+
Stream *wrappedQUICStream
365365
CloseFunc func()
366366
UDPSessionID uint32
367367
MsgCh <-chan *udpMessage

transport/hysteria/core/stream.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// Handle stream close properly
1010
// Ref: https://github.com/libp2p/go-libp2p-quic-transport/blob/master/stream.go
1111
type wrappedQUICStream struct {
12-
Stream quic.Stream
12+
Stream *quic.Stream
1313
}
1414

1515
func (s *wrappedQUICStream) StreamID() quic.StreamID {

transport/hysteria/transport/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (ct *ClientTransport) quicPacketConn(proto string, rAddr net.Addr, serverPo
6262
}
6363
}
6464

65-
func (ct *ClientTransport) QUICDial(proto string, server string, serverPorts string, tlsConfig *tlsC.Config, quicConfig *quic.Config, obfs obfsPkg.Obfuscator, hopInterval time.Duration, dialer utils.PacketDialer) (quic.Connection, error) {
65+
func (ct *ClientTransport) QUICDial(proto string, server string, serverPorts string, tlsConfig *tlsC.Config, quicConfig *quic.Config, obfs obfsPkg.Obfuscator, hopInterval time.Duration, dialer utils.PacketDialer) (*quic.Conn, error) {
6666
serverUDPAddr, err := dialer.RemoteAddr(server)
6767
if err != nil {
6868
return nil, err

transport/tuic/common/congestion.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const (
1313
DefaultConnectionReceiveWindow = 67108864 // 64 MB/s
1414
)
1515

16-
func SetCongestionController(quicConn quic.Connection, cc string, cwnd int) {
16+
func SetCongestionController(quicConn *quic.Conn, cc string, cwnd int) {
1717
if cwnd == 0 {
1818
cwnd = 32
1919
}

transport/tuic/common/stream.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
type quicStreamConn struct {
12-
quic.Stream
12+
*quic.Stream
1313
lock sync.Mutex
1414
lAddr net.Addr
1515
rAddr net.Addr
@@ -62,6 +62,6 @@ func (q *quicStreamConn) RemoteAddr() net.Addr {
6262

6363
var _ net.Conn = (*quicStreamConn)(nil)
6464

65-
func NewQuicStreamConn(stream quic.Stream, lAddr, rAddr net.Addr, closeDeferFn func()) net.Conn {
65+
func NewQuicStreamConn(stream *quic.Stream, lAddr, rAddr net.Addr, closeDeferFn func()) net.Conn {
6666
return &quicStreamConn{Stream: stream, lAddr: lAddr, rAddr: rAddr, closeDeferFn: closeDeferFn}
6767
}

transport/tuic/congestion/bbr_sender.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const (
2020
DefaultBBRMaxCongestionWindow = 10000
2121
)
2222

23-
func GetInitialPacketSize(quicConn quic.Connection) congestion.ByteCount {
23+
func GetInitialPacketSize(quicConn *quic.Conn) congestion.ByteCount {
2424
return congestion.ByteCount(quicConn.Config().InitialPacketSize)
2525
}
2626

0 commit comments

Comments
 (0)