mirror of
https://github.com/SagerNet/sing-quic.git
synced 2025-04-03 20:07:39 +03:00
Update quic-go to v0.42.0
This commit is contained in:
parent
e18a59987e
commit
2fdf8165ae
5 changed files with 21 additions and 21 deletions
2
go.mod
2
go.mod
|
@ -4,7 +4,7 @@ go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/gofrs/uuid/v5 v5.1.0
|
github.com/gofrs/uuid/v5 v5.1.0
|
||||||
github.com/sagernet/quic-go v0.40.1
|
github.com/sagernet/quic-go v0.42.0-beta.3
|
||||||
github.com/sagernet/sing v0.3.8
|
github.com/sagernet/sing v0.3.8
|
||||||
golang.org/x/crypto v0.22.0
|
golang.org/x/crypto v0.22.0
|
||||||
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
|
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
|
||||||
|
|
4
go.sum
4
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/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 h1:D33340mCNDAIKBqXuAvexTNMUByrYmFYVfKfDN5nfFs=
|
||||||
github.com/quic-go/qtls-go1-20 v0.4.1/go.mod h1:X9Nh97ZL80Z+bX/gUXMbipO6OxdiDi58b/fMC9mAL+k=
|
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.1 h1:qLeTIJR0d0JWRmDWo346nLsVN6EWihd1kalJYPEd0TM=
|
github.com/sagernet/quic-go v0.42.0-beta.3 h1:cspu1Uh1KriiDmW42OaPYokeGZT2OyfIcRMV2BdNtEo=
|
||||||
github.com/sagernet/quic-go v0.40.1/go.mod h1:CcKTpzTAISxrM4PA5M20/wYuz9Tj6Tx4DwGbNl9UQrU=
|
github.com/sagernet/quic-go v0.42.0-beta.3/go.mod h1:lf8OYop+fMxIlrfM/ZHpENt/7ZD4JaVNqMhOlq2QMwg=
|
||||||
github.com/sagernet/sing v0.3.8 h1:gm4JKalPhydMYX2zFOTnnd4TXtM/16WFRqSjMepYQQk=
|
github.com/sagernet/sing v0.3.8 h1:gm4JKalPhydMYX2zFOTnnd4TXtM/16WFRqSjMepYQQk=
|
||||||
github.com/sagernet/sing v0.3.8/go.mod h1:+60H3Cm91RnL9dpVGWDPHt0zTQImO9Vfqt9a4rSambI=
|
github.com/sagernet/sing v0.3.8/go.mod h1:+60H3Cm91RnL9dpVGWDPHt0zTQImO9Vfqt9a4rSambI=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
|
|
@ -182,7 +182,7 @@ func (c *udpPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr)
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if buffer.Len() > 0xffff {
|
if buffer.Len() > 0xffff {
|
||||||
return quic.ErrMessageTooLarge(0xffff)
|
return &quic.DatagramTooLargeError{PeerMaxDatagramFrameSize: 0xffff}
|
||||||
}
|
}
|
||||||
packetId := uint16(c.packetId.Add(1) % math.MaxUint16)
|
packetId := uint16(c.packetId.Add(1) % math.MaxUint16)
|
||||||
message := allocMessage()
|
message := allocMessage()
|
||||||
|
@ -204,11 +204,11 @@ func (c *udpPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var tooLargeErr quic.ErrMessageTooLarge
|
var tooLargeErr *quic.DatagramTooLargeError
|
||||||
if !errors.As(err, &tooLargeErr) {
|
if !errors.As(err, &tooLargeErr) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return c.writePackets(fragUDPMessage(message, int(tooLargeErr)-3))
|
return c.writePackets(fragUDPMessage(message, int(tooLargeErr.PeerMaxDatagramFrameSize-3)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
||||||
|
@ -218,7 +218,7 @@ func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if len(p) > 0xffff {
|
if len(p) > 0xffff {
|
||||||
return 0, quic.ErrMessageTooLarge(0xffff)
|
return 0, &quic.DatagramTooLargeError{PeerMaxDatagramFrameSize: 0xffff}
|
||||||
}
|
}
|
||||||
packetId := uint16(c.packetId.Add(1) % math.MaxUint16)
|
packetId := uint16(c.packetId.Add(1) % math.MaxUint16)
|
||||||
message := allocMessage()
|
message := allocMessage()
|
||||||
|
@ -242,11 +242,11 @@ func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
var tooLargeErr quic.ErrMessageTooLarge
|
var tooLargeErr *quic.DatagramTooLargeError
|
||||||
if !errors.As(err, &tooLargeErr) {
|
if !errors.As(err, &tooLargeErr) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = c.writePackets(fragUDPMessage(message, int(tooLargeErr)-3))
|
err = c.writePackets(fragUDPMessage(message, int(tooLargeErr.PeerMaxDatagramFrameSize-3)))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ func (c *udpPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr)
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if buffer.Len() > 0xffff {
|
if buffer.Len() > 0xffff {
|
||||||
return quic.ErrMessageTooLarge(0xffff)
|
return &quic.DatagramTooLargeError{PeerMaxDatagramFrameSize: 0xffff}
|
||||||
}
|
}
|
||||||
packetId := uint16(c.packetId.Add(1) % math.MaxUint16)
|
packetId := uint16(c.packetId.Add(1) % math.MaxUint16)
|
||||||
message := allocMessage()
|
message := allocMessage()
|
||||||
|
@ -199,11 +199,11 @@ func (c *udpPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var tooLargeErr quic.ErrMessageTooLarge
|
var tooLargeErr *quic.DatagramTooLargeError
|
||||||
if !errors.As(err, &tooLargeErr) {
|
if !errors.As(err, &tooLargeErr) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return c.writePackets(fragUDPMessage(message, int(tooLargeErr)-3))
|
return c.writePackets(fragUDPMessage(message, int(tooLargeErr.PeerMaxDatagramFrameSize-3)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
||||||
|
@ -213,7 +213,7 @@ func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if len(p) > 0xffff {
|
if len(p) > 0xffff {
|
||||||
return 0, quic.ErrMessageTooLarge(0xffff)
|
return 0, &quic.DatagramTooLargeError{PeerMaxDatagramFrameSize: 0xffff}
|
||||||
}
|
}
|
||||||
packetId := uint16(c.packetId.Add(1) % math.MaxUint16)
|
packetId := uint16(c.packetId.Add(1) % math.MaxUint16)
|
||||||
message := allocMessage()
|
message := allocMessage()
|
||||||
|
@ -235,11 +235,11 @@ func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
var tooLargeErr quic.ErrMessageTooLarge
|
var tooLargeErr *quic.DatagramTooLargeError
|
||||||
if !errors.As(err, &tooLargeErr) {
|
if !errors.As(err, &tooLargeErr) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = c.writePackets(fragUDPMessage(message, int(tooLargeErr)-3))
|
err = c.writePackets(fragUDPMessage(message, int(tooLargeErr.PeerMaxDatagramFrameSize-3)))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ func (c *udpPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr)
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if buffer.Len() > 0xffff {
|
if buffer.Len() > 0xffff {
|
||||||
return quic.ErrMessageTooLarge(0xffff)
|
return &quic.DatagramTooLargeError{PeerMaxDatagramFrameSize: 0xffff}
|
||||||
}
|
}
|
||||||
if !destination.IsValid() {
|
if !destination.IsValid() {
|
||||||
return E.New("invalid destination address")
|
return E.New("invalid destination address")
|
||||||
|
@ -211,11 +211,11 @@ func (c *udpPacketConn) WritePacket(buffer *buf.Buffer, destination M.Socksaddr)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var tooLargeErr quic.ErrMessageTooLarge
|
var tooLargeErr *quic.DatagramTooLargeError
|
||||||
if !errors.As(err, &tooLargeErr) {
|
if !errors.As(err, &tooLargeErr) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c.udpMTU = int(tooLargeErr) - 3
|
c.udpMTU = int(tooLargeErr.PeerMaxDatagramFrameSize) - 3
|
||||||
return c.writePackets(fragUDPMessage(message, c.udpMTU))
|
return c.writePackets(fragUDPMessage(message, c.udpMTU))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if len(p) > 0xffff {
|
if len(p) > 0xffff {
|
||||||
return 0, quic.ErrMessageTooLarge(0xffff)
|
return 0, &quic.DatagramTooLargeError{PeerMaxDatagramFrameSize: 0xffff}
|
||||||
}
|
}
|
||||||
destination := M.SocksaddrFromNet(addr)
|
destination := M.SocksaddrFromNet(addr)
|
||||||
if !destination.IsValid() {
|
if !destination.IsValid() {
|
||||||
|
@ -252,11 +252,11 @@ func (c *udpPacketConn) WriteTo(p []byte, addr net.Addr) (n int, err error) {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
}
|
}
|
||||||
var tooLargeErr quic.ErrMessageTooLarge
|
var tooLargeErr *quic.DatagramTooLargeError
|
||||||
if !errors.As(err, &tooLargeErr) {
|
if !errors.As(err, &tooLargeErr) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.udpMTU = int(tooLargeErr) - 3
|
c.udpMTU = int(tooLargeErr.PeerMaxDatagramFrameSize) - 3
|
||||||
err = c.writePackets(fragUDPMessage(message, c.udpMTU))
|
err = c.writePackets(fragUDPMessage(message, c.udpMTU))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return len(p), nil
|
return len(p), nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue