From cf3aaf5bffb84baacff6e01bb00c260fe70114b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sun, 28 Apr 2024 13:14:04 +0800 Subject: [PATCH] Update quic-go to v0.43.0 --- go.mod | 2 +- go.sum | 4 ++-- hysteria2/client.go | 2 +- hysteria2/service.go | 2 +- quic.go | 9 ++++----- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 169c2a7..de65516 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/gofrs/uuid/v5 v5.1.0 - github.com/sagernet/quic-go v0.42.0-beta.3 + github.com/sagernet/quic-go v0.43.0-beta.3 github.com/sagernet/sing v0.3.8 golang.org/x/crypto v0.22.0 golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f diff --git a/go.sum b/go.sum index fa6d261..2b21eda 100644 --- a/go.sum +++ b/go.sum @@ -21,8 +21,8 @@ github.com/quic-go/qpack v0.4.0 h1:Cr9BXA1sQS2SmDUWjSofMPNKmvF6IiIfDRmgU0w1ZCo= github.com/quic-go/qpack v0.4.0/go.mod h1:UZVnYIfi5GRk+zI9UMaCPsmZ2xKJP7XBUvVyT1Knj9A= github.com/quic-go/qtls-go1-20 v0.4.1 h1:D33340mCNDAIKBqXuAvexTNMUByrYmFYVfKfDN5nfFs= github.com/quic-go/qtls-go1-20 v0.4.1/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/sagernet/quic-go v0.42.0-beta.3 h1:cspu1Uh1KriiDmW42OaPYokeGZT2OyfIcRMV2BdNtEo= -github.com/sagernet/quic-go v0.42.0-beta.3/go.mod h1:lf8OYop+fMxIlrfM/ZHpENt/7ZD4JaVNqMhOlq2QMwg= +github.com/sagernet/quic-go v0.43.0-beta.3 h1:qclJbbpgZe76EH62Bdu3LfDSC2zmuxj7zXCpdQBbe7c= +github.com/sagernet/quic-go v0.43.0-beta.3/go.mod h1:3EtxR1Yaa1FZu6jFPiBHpOAdhOxL4A3EPxmiVgjJvVM= github.com/sagernet/sing v0.3.8 h1:gm4JKalPhydMYX2zFOTnnd4TXtM/16WFRqSjMepYQQk= github.com/sagernet/sing v0.3.8/go.mod h1:+60H3Cm91RnL9dpVGWDPHt0zTQImO9Vfqt9a4rSambI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/hysteria2/client.go b/hysteria2/client.go index 904c8bc..894aa0c 100644 --- a/hysteria2/client.go +++ b/hysteria2/client.go @@ -121,7 +121,7 @@ func (c *Client) offerNew(ctx context.Context) (*clientQUICConnection, error) { packetConn = NewSalamanderConn(packetConn, []byte(c.salamanderPassword)) } var quicConn quic.EarlyConnection - http3Transport, err := qtls.CreateTransport(packetConn, &quicConn, c.serverAddr, c.tlsConfig, c.quicConfig, true) + http3Transport, err := qtls.CreateTransport(packetConn, &quicConn, c.serverAddr, c.tlsConfig, c.quicConfig) if err != nil { udpConn.Close() return nil, err diff --git a/hysteria2/service.go b/hysteria2/service.go index ba86240..ed54963 100644 --- a/hysteria2/service.go +++ b/hysteria2/service.go @@ -241,7 +241,7 @@ func (s *serverSession[U]) ServeHTTP(w http.ResponseWriter, r *http.Request) { } } -func (s *serverSession[U]) handleStream0(frameType http3.FrameType, connection quic.Connection, stream quic.Stream, err error) (bool, error) { +func (s *serverSession[U]) handleStream0(frameType http3.FrameType, id quic.ConnectionTracingID, stream quic.Stream, err error) (bool, error) { if !s.authenticated || err != nil { return false, nil } diff --git a/quic.go b/quic.go index 69ceba1..193a7cf 100644 --- a/quic.go +++ b/quic.go @@ -15,7 +15,7 @@ import ( type Config interface { Dial(ctx context.Context, conn net.PacketConn, addr net.Addr, config *quic.Config) (quic.Connection, error) DialEarly(ctx context.Context, conn net.PacketConn, addr net.Addr, config *quic.Config) (quic.EarlyConnection, error) - CreateTransport(conn net.PacketConn, quicConnPtr *quic.EarlyConnection, serverAddr M.Socksaddr, quicConfig *quic.Config, enableDatagrams bool) http.RoundTripper + CreateTransport(conn net.PacketConn, quicConnPtr *quic.EarlyConnection, serverAddr M.Socksaddr, quicConfig *quic.Config) http.RoundTripper } type ServerConfig interface { @@ -58,9 +58,9 @@ func DialEarly(ctx context.Context, conn net.PacketConn, addr net.Addr, config a return quic.DialEarly(ctx, conn, addr, tlsConfig, quicConfig) } -func CreateTransport(conn net.PacketConn, quicConnPtr *quic.EarlyConnection, serverAddr M.Socksaddr, config aTLS.Config, quicConfig *quic.Config, enableDatagrams bool) (http.RoundTripper, error) { +func CreateTransport(conn net.PacketConn, quicConnPtr *quic.EarlyConnection, serverAddr M.Socksaddr, config aTLS.Config, quicConfig *quic.Config) (http.RoundTripper, error) { if quicTLSConfig, isQUICConfig := config.(Config); isQUICConfig { - return quicTLSConfig.CreateTransport(conn, quicConnPtr, serverAddr, quicConfig, enableDatagrams), nil + return quicTLSConfig.CreateTransport(conn, quicConnPtr, serverAddr, quicConfig), nil } tlsConfig, err := config.Config() if err != nil { @@ -68,8 +68,7 @@ func CreateTransport(conn net.PacketConn, quicConnPtr *quic.EarlyConnection, ser } return &http3.RoundTripper{ TLSClientConfig: tlsConfig, - QuicConfig: quicConfig, - EnableDatagrams: enableDatagrams, + QUICConfig: quicConfig, Dial: func(ctx context.Context, addr string, tlsCfg *tls.Config, cfg *quic.Config) (quic.EarlyConnection, error) { quicConn, err := quic.DialEarly(ctx, conn, serverAddr.UDPAddr(), tlsCfg, cfg) if err != nil {