Skip to content

Commit de3d214

Browse files
committed
chore: update quic-go to 0.44.0
1 parent bd43eca commit de3d214

File tree

7 files changed

+19
-40
lines changed

7 files changed

+19
-40
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/lunixbochs/struc v0.0.0-20200707160740-784aaebc1d40
2020
github.com/mdlayher/netlink v1.7.2
2121
github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759
22-
github.com/metacubex/quic-go v0.43.2-0.20240518033621-2c3d14c6b38e
22+
github.com/metacubex/quic-go v0.44.1-0.20240520163451-20b689a59136
2323
github.com/metacubex/sing-quic v0.0.0-20240518034124-7696d3f7da72
2424
github.com/metacubex/sing-shadowsocks v0.2.6
2525
github.com/metacubex/sing-shadowsocks2 v0.2.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759 h1:cjd4biTvO
104104
github.com/metacubex/gopacket v1.1.20-0.20230608035415-7e2f98a3e759/go.mod h1:UHOv2xu+RIgLwpXca7TLrXleEd4oR3sPatW6IF8wU88=
105105
github.com/metacubex/gvisor v0.0.0-20240320004321-933faba989ec h1:HxreOiFTUrJXJautEo8rnE1uKTVGY8wtZepY1Tii/Nc=
106106
github.com/metacubex/gvisor v0.0.0-20240320004321-933faba989ec/go.mod h1:8BVmQ+3cxjqzWElafm24rb2Ae4jRI6vAXNXWqWjfrXw=
107-
github.com/metacubex/quic-go v0.43.2-0.20240518033621-2c3d14c6b38e h1:Nzwe08FNIJpExWpy9iXkG336dN/8nJqn69yijB7vJ8g=
108-
github.com/metacubex/quic-go v0.43.2-0.20240518033621-2c3d14c6b38e/go.mod h1:uXHODgJFUfUnkkCMWLd5Er6L5QY/LFRZb9LD5jyyhsk=
107+
github.com/metacubex/quic-go v0.44.1-0.20240520163451-20b689a59136 h1:Z9XGYDs6QuSqipNcxbTx+baN/bBBAIpRxVhLpoMF42U=
108+
github.com/metacubex/quic-go v0.44.1-0.20240520163451-20b689a59136/go.mod h1:88wAATpevav4xdy5N8oejQ2cbbI6EcLYEklFeo+qywA=
109109
github.com/metacubex/sing v0.0.0-20240518125217-e63d65a914d1 h1:7hDHLTmjgtRoAp59STwPQpe5Pinwi4cWex+FB3Ohvco=
110110
github.com/metacubex/sing v0.0.0-20240518125217-e63d65a914d1/go.mod h1:+60H3Cm91RnL9dpVGWDPHt0zTQImO9Vfqt9a4rSambI=
111111
github.com/metacubex/sing-quic v0.0.0-20240518034124-7696d3f7da72 h1:Wr4g1HCb5Z/QIFwFiVNjO2qL+dRu25+Mdn9xtAZZ+ew=

transport/tuic/common/congestion.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ func SetCongestionController(quicConn quic.Connection, cc string, cwnd int) {
2222
quicConn.SetCongestionControl(
2323
congestion.NewCubicSender(
2424
congestion.DefaultClock{},
25-
congestion.GetInitialPacketSize(quicConn.RemoteAddr()),
25+
congestion.GetInitialPacketSize(quicConn),
2626
false,
2727
),
2828
)
2929
case "new_reno":
3030
quicConn.SetCongestionControl(
3131
congestion.NewCubicSender(
3232
congestion.DefaultClock{},
33-
congestion.GetInitialPacketSize(quicConn.RemoteAddr()),
33+
congestion.GetInitialPacketSize(quicConn),
3434
true,
3535
),
3636
)
3737
case "bbr_meta_v1":
3838
quicConn.SetCongestionControl(
3939
congestion.NewBBRSender(
4040
congestion.DefaultClock{},
41-
congestion.GetInitialPacketSize(quicConn.RemoteAddr()),
41+
congestion.GetInitialPacketSize(quicConn),
4242
c.ByteCount(cwnd)*congestion.InitialMaxDatagramSize,
4343
congestion.DefaultBBRMaxCongestionWindow*congestion.InitialMaxDatagramSize,
4444
),
@@ -49,7 +49,7 @@ func SetCongestionController(quicConn quic.Connection, cc string, cwnd int) {
4949
quicConn.SetCongestionControl(
5050
congestionv2.NewBbrSender(
5151
congestionv2.DefaultClock{},
52-
congestionv2.GetInitialPacketSize(quicConn.RemoteAddr()),
52+
congestionv2.GetInitialPacketSize(quicConn),
5353
c.ByteCount(cwnd),
5454
),
5555
)

transport/tuic/congestion/bbr_sender.go

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,23 @@ package congestion
55
import (
66
"fmt"
77
"math"
8-
"net"
98
"time"
109

10+
"github.com/metacubex/quic-go"
1111
"github.com/metacubex/quic-go/congestion"
1212
"github.com/zhangyunhao116/fastrand"
1313
)
1414

1515
const (
1616
// InitialMaxDatagramSize is the default maximum packet size used in QUIC for congestion window computations in bytes.
17-
InitialMaxDatagramSize = 1252
18-
InitialPacketSizeIPv4 = 1252
19-
InitialPacketSizeIPv6 = 1232
17+
InitialMaxDatagramSize = 1280
18+
InitialPacketSize = 1280
2019
InitialCongestionWindow = 32
2120
DefaultBBRMaxCongestionWindow = 10000
2221
)
2322

24-
func GetInitialPacketSize(addr net.Addr) congestion.ByteCount {
25-
maxSize := congestion.ByteCount(1200)
26-
// If this is not a UDP address, we don't know anything about the MTU.
27-
// Use the minimum size of an Initial packet as the max packet size.
28-
if udpAddr, ok := addr.(*net.UDPAddr); ok {
29-
if udpAddr.IP.To4() != nil {
30-
maxSize = InitialPacketSizeIPv4
31-
} else {
32-
maxSize = InitialPacketSizeIPv6
33-
}
34-
}
35-
return congestion.ByteCount(maxSize)
23+
func GetInitialPacketSize(quicConn quic.Connection) congestion.ByteCount {
24+
return congestion.ByteCount(quicConn.Config().InitialPacketSize)
3625
}
3726

3827
var (

transport/tuic/congestion/cubic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const (
2121
cubeCongestionWindowScale = 410
2222
cubeFactor congestion.ByteCount = 1 << cubeScale / cubeCongestionWindowScale / maxDatagramSize
2323
// TODO: when re-enabling cubic, make sure to use the actual packet size here
24-
maxDatagramSize = congestion.ByteCount(InitialPacketSizeIPv4)
24+
maxDatagramSize = congestion.ByteCount(InitialPacketSize)
2525
)
2626

2727
const defaultNumConnections = 1

transport/tuic/congestion_v2/bbr_sender.go

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ package congestion
44

55
import (
66
"fmt"
7-
"net"
87
"time"
98

9+
"github.com/metacubex/quic-go"
1010
"github.com/metacubex/quic-go/congestion"
1111

1212
"github.com/zhangyunhao116/fastrand"
@@ -30,7 +30,7 @@ const (
3030
// Constants based on TCP defaults.
3131
// The minimum CWND to ensure delayed acks don't reduce bandwidth measurements.
3232
// Does not inflate the pacing rate.
33-
defaultMinimumCongestionWindow = 4 * congestion.ByteCount(congestion.InitialPacketSizeIPv4)
33+
defaultMinimumCongestionWindow = 4 * congestion.ByteCount(congestion.InitialPacketSize)
3434

3535
// The gain used for the STARTUP, equal to 2/ln(2).
3636
defaultHighGain = 2.885
@@ -931,16 +931,6 @@ func bdpFromRttAndBandwidth(rtt time.Duration, bandwidth Bandwidth) congestion.B
931931
return congestion.ByteCount(rtt) * congestion.ByteCount(bandwidth) / congestion.ByteCount(BytesPerSecond) / congestion.ByteCount(time.Second)
932932
}
933933

934-
func GetInitialPacketSize(addr net.Addr) congestion.ByteCount {
935-
// If this is not a UDP address, we don't know anything about the MTU.
936-
// Use the minimum size of an Initial packet as the max packet size.
937-
if udpAddr, ok := addr.(*net.UDPAddr); ok {
938-
if udpAddr.IP.To4() != nil {
939-
return congestion.InitialPacketSizeIPv4
940-
} else {
941-
return congestion.InitialPacketSizeIPv6
942-
}
943-
} else {
944-
return congestion.MinInitialPacketSize
945-
}
934+
func GetInitialPacketSize(quicConn quic.Connection) congestion.ByteCount {
935+
return congestion.ByteCount(quicConn.Config().InitialPacketSize)
946936
}

transport/tuic/congestion_v2/pacer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ type Pacer struct {
2121

2222
func NewPacer(getBandwidth func() congestion.ByteCount) *Pacer {
2323
p := &Pacer{
24-
budgetAtLastSent: maxBurstPackets * congestion.InitialPacketSizeIPv4,
25-
maxDatagramSize: congestion.InitialPacketSizeIPv4,
24+
budgetAtLastSent: maxBurstPackets * congestion.InitialPacketSize,
25+
maxDatagramSize: congestion.InitialPacketSize,
2626
getBandwidth: getBandwidth,
2727
}
2828
return p

0 commit comments

Comments
 (0)