diff --git a/go.mod b/go.mod index 13f7927..5be7e26 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.20 require ( github.com/gofrs/uuid/v5 v5.0.0 - github.com/sagernet/quic-go v0.0.0-20231008035953-32727fef9460 + github.com/sagernet/quic-go v0.40.0 github.com/sagernet/sing v0.2.17 golang.org/x/crypto v0.15.0 golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa @@ -12,10 +12,10 @@ require ( require ( github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect - github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect - github.com/onsi/ginkgo/v2 v2.9.5 // indirect + github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a // indirect + github.com/onsi/ginkgo/v2 v2.9.7 // indirect github.com/quic-go/qpack v0.4.0 // indirect - github.com/quic-go/qtls-go1-20 v0.3.4 // indirect + github.com/quic-go/qtls-go1-20 v0.4.1 // indirect github.com/stretchr/testify v1.8.4 // indirect golang.org/x/net v0.18.0 // indirect golang.org/x/sys v0.14.0 // indirect diff --git a/go.sum b/go.sum index 9f1e19f..2600f51 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,3 @@ -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -13,20 +10,19 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 h1:yAJXTCF9TqKcTiHJAE8dj7HMvPfh66eeA2JYW7eFpSE= -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/onsi/ginkgo/v2 v2.9.5 h1:+6Hr4uxzP4XIUyAkg61dWBw8lb/gc4/X5luuxN/EC+Q= -github.com/onsi/ginkgo/v2 v2.9.5/go.mod h1:tvAoo1QUJwNEU2ITftXTpR7R1RbCzoZUOs3RonqW57k= -github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= +github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a h1:fEBsGL/sjAuJrgah5XqmmYsTLzJp/TO9Lhy39gkverk= +github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= +github.com/onsi/ginkgo/v2 v2.9.7 h1:06xGQy5www2oN160RtEZoTvnP2sPhEfePYmCDc2szss= +github.com/onsi/ginkgo/v2 v2.9.7/go.mod h1:cxrmXWykAwTwhQsJOPfdIDiJ+l2RYq7U8hFU+M/1uw0= +github.com/onsi/gomega v1.27.7 h1:fVih9JD6ogIiHUN6ePK7HJidyEDpWGVB5mzM7cWNXoU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 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.3.4 h1:MfFAPULvst4yoMgY9QmtpYmfij/em7O8UUi+bNVm7Cg= -github.com/quic-go/qtls-go1-20 v0.3.4/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k= -github.com/sagernet/quic-go v0.0.0-20231008035953-32727fef9460 h1:dAe4OIJAtE0nHOzTHhAReQteh3+sa63rvXbuIpbeOTY= -github.com/sagernet/quic-go v0.0.0-20231008035953-32727fef9460/go.mod h1:uJGpmJCOcMQqMlHKc3P1Vz6uygmpz4bPeVIoOhdVQnM= +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.40.0 h1:DvQNPb72lzvNQDe9tcUyHTw8eRv6PLtM2mNYmdlzUMo= +github.com/sagernet/quic-go v0.40.0/go.mod h1:VqtdhlbkeeG5Okhb3eDMb/9o0EoglReHunNT9ukrJAI= github.com/sagernet/sing v0.2.17 h1:vMPKb3MV0Aa5ws4dCJkRI8XEjrsUcDn810czd0FwmzI= github.com/sagernet/sing v0.2.17/go.mod h1:OL6k2F0vHmEzXz2KW19qQzu172FDgSbUSODylighuVo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -40,7 +36,6 @@ golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUU golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= diff --git a/hysteria/client_paclet.go b/hysteria/client_paclet.go index a77e9ff..9148ce6 100644 --- a/hysteria/client_paclet.go +++ b/hysteria/client_paclet.go @@ -4,7 +4,7 @@ import E "github.com/sagernet/sing/common/exceptions" func (c *Client) loopMessages(conn *clientQUICConnection) { for { - message, err := conn.quicConn.ReceiveMessage(c.ctx) + message, err := conn.quicConn.ReceiveDatagram(c.ctx) if err != nil { conn.closeWithError(E.Cause(err, "receive message")) return diff --git a/hysteria/packet.go b/hysteria/packet.go index b742c4a..9d148d8 100644 --- a/hysteria/packet.go +++ b/hysteria/packet.go @@ -327,7 +327,7 @@ func (c *udpPacketConn) writePackets(messages []*udpMessage) error { func (c *udpPacketConn) writePacket(message *udpMessage) error { buffer := message.pack() defer buffer.Release() - return c.quicConn.SendMessage(buffer.Bytes()) + return c.quicConn.SendDatagram(buffer.Bytes()) } func (c *udpPacketConn) Close() error { diff --git a/hysteria/service_packet.go b/hysteria/service_packet.go index a1fbab2..8d30d5d 100644 --- a/hysteria/service_packet.go +++ b/hysteria/service_packet.go @@ -7,7 +7,7 @@ import ( func (s *serverSession[U]) loopMessages() { for { - message, err := s.quicConn.ReceiveMessage(s.ctx) + message, err := s.quicConn.ReceiveDatagram(s.ctx) if err != nil { s.closeWithError(E.Cause(err, "receive message")) return diff --git a/hysteria2/client_paclet.go b/hysteria2/client_paclet.go index 21198bf..372f8bc 100644 --- a/hysteria2/client_paclet.go +++ b/hysteria2/client_paclet.go @@ -4,7 +4,7 @@ import E "github.com/sagernet/sing/common/exceptions" func (c *Client) loopMessages(conn *clientQUICConnection) { for { - message, err := conn.quicConn.ReceiveMessage(c.ctx) + message, err := conn.quicConn.ReceiveDatagram(c.ctx) if err != nil { conn.closeWithError(E.Cause(err, "receive message")) return diff --git a/hysteria2/packet.go b/hysteria2/packet.go index 9057fd3..286bf3b 100644 --- a/hysteria2/packet.go +++ b/hysteria2/packet.go @@ -320,7 +320,7 @@ func (c *udpPacketConn) writePackets(messages []*udpMessage) error { func (c *udpPacketConn) writePacket(message *udpMessage) error { buffer := message.pack() defer buffer.Release() - return c.quicConn.SendMessage(buffer.Bytes()) + return c.quicConn.SendDatagram(buffer.Bytes()) } func (c *udpPacketConn) Close() error { diff --git a/hysteria2/service_packet.go b/hysteria2/service_packet.go index a0482bc..8ac6e03 100644 --- a/hysteria2/service_packet.go +++ b/hysteria2/service_packet.go @@ -9,7 +9,7 @@ import ( func (s *serverSession[U]) loopMessages() { for { - message, err := s.quicConn.ReceiveMessage(s.ctx) + message, err := s.quicConn.ReceiveDatagram(s.ctx) if err != nil { s.closeWithError(E.Cause(err, "receive message")) return diff --git a/tuic/client.go b/tuic/client.go index 35a8ed5..bee410c 100644 --- a/tuic/client.go +++ b/tuic/client.go @@ -56,7 +56,6 @@ func NewClient(options ClientOptions) (*Client, error) { } quicConfig := &quic.Config{ DisablePathMTUDiscovery: !(runtime.GOOS == "windows" || runtime.GOOS == "linux" || runtime.GOOS == "android" || runtime.GOOS == "darwin"), - MaxDatagramFrameSize: 1400, EnableDatagrams: true, MaxIncomingUniStreams: 1 << 60, } @@ -164,7 +163,7 @@ func (c *Client) loopHeartbeats(conn *clientQUICConnection) { case <-conn.connDone: return case <-ticker.C: - err := conn.quicConn.SendMessage([]byte{Version, CommandHeartbeat}) + err := conn.quicConn.SendDatagram([]byte{Version, CommandHeartbeat}) if err != nil { conn.closeWithError(E.Cause(err, "send heartbeat")) } diff --git a/tuic/client_packet.go b/tuic/client_packet.go index 48da97a..e76cf5c 100644 --- a/tuic/client_packet.go +++ b/tuic/client_packet.go @@ -11,7 +11,7 @@ import ( func (c *Client) loopMessages(conn *clientQUICConnection) { for { - message, err := conn.quicConn.ReceiveMessage(c.ctx) + message, err := conn.quicConn.ReceiveDatagram(c.ctx) if err != nil { conn.closeWithError(E.Cause(err, "receive message")) return diff --git a/tuic/packet.go b/tuic/packet.go index 83fbe5b..8b52de2 100644 --- a/tuic/packet.go +++ b/tuic/packet.go @@ -331,7 +331,7 @@ func (c *udpPacketConn) writePackets(messages []*udpMessage) error { func (c *udpPacketConn) writePacket(message *udpMessage) error { if !c.udpStream { buffer := message.pack() - err := c.quicConn.SendMessage(buffer.Bytes()) + err := c.quicConn.SendDatagram(buffer.Bytes()) buffer.Release() if err != nil { return err diff --git a/tuic/service.go b/tuic/service.go index e173bbb..f9fb5ca 100644 --- a/tuic/service.go +++ b/tuic/service.go @@ -67,7 +67,6 @@ func NewService[U comparable](options ServiceOptions) (*Service[U], error) { } quicConfig := &quic.Config{ DisablePathMTUDiscovery: !(runtime.GOOS == "windows" || runtime.GOOS == "linux" || runtime.GOOS == "android" || runtime.GOOS == "darwin"), - MaxDatagramFrameSize: 1400, EnableDatagrams: true, Allow0RTT: options.ZeroRTTHandshake, MaxIncomingStreams: 1 << 60, @@ -376,7 +375,7 @@ func (s *serverSession[U]) loopHeartbeats() { case <-s.connDone: return case <-ticker.C: - err := s.quicConn.SendMessage([]byte{Version, CommandHeartbeat}) + err := s.quicConn.SendDatagram([]byte{Version, CommandHeartbeat}) if err != nil { s.closeWithError(E.Cause(err, "send heartbeat")) } diff --git a/tuic/service_packet.go b/tuic/service_packet.go index 9ddbfac..d4c31c3 100644 --- a/tuic/service_packet.go +++ b/tuic/service_packet.go @@ -14,7 +14,7 @@ func (s *serverSession[U]) loopMessages() { case <-s.authDone: } for { - message, err := s.quicConn.ReceiveMessage(s.ctx) + message, err := s.quicConn.ReceiveDatagram(s.ctx) if err != nil { s.closeWithError(E.Cause(err, "receive message")) return