Skip to content

Commit

Permalink
chore: add new bbr implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Sep 30, 2023
1 parent fedad26 commit 828b5ad
Show file tree
Hide file tree
Showing 15 changed files with 2,439 additions and 694 deletions.
27 changes: 11 additions & 16 deletions transport/tuic/common/congestion.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package common

import (
"github.com/Dreamacro/clash/transport/tuic/congestion"
congestionv2 "github.com/Dreamacro/clash/transport/tuic/congestion_v2"

"github.com/metacubex/quic-go"
c "github.com/metacubex/quic-go/congestion"
Expand All @@ -17,29 +18,23 @@ func SetCongestionController(quicConn quic.Connection, cc string, cwnd int) {
cwnd = 32
}
switch cc {
case "cubic":
case "bbr_meta_v1":
quicConn.SetCongestionControl(
congestion.NewCubicSender(
congestion.DefaultClock{},
congestion.GetInitialPacketSize(quicConn.RemoteAddr()),
false,
),
)
case "new_reno":
quicConn.SetCongestionControl(
congestion.NewCubicSender(
congestion.NewBBRSender(
congestion.DefaultClock{},
congestion.GetInitialPacketSize(quicConn.RemoteAddr()),
true,
c.ByteCount(cwnd)*congestion.InitialMaxDatagramSize,
congestion.DefaultBBRMaxCongestionWindow*congestion.InitialMaxDatagramSize,
),
)
case "bbr_meta_v2":
fallthrough
case "bbr":
quicConn.SetCongestionControl(
congestion.NewBBRSender(
congestion.DefaultClock{},
congestion.GetInitialPacketSize(quicConn.RemoteAddr()),
c.ByteCount(cwnd)*congestion.InitialMaxDatagramSize,
congestion.DefaultBBRMaxCongestionWindow*congestion.InitialMaxDatagramSize,
congestionv2.NewBbrSender(
congestionv2.DefaultClock{},
congestionv2.GetInitialPacketSize(quicConn.RemoteAddr()),
c.ByteCount(cwnd),
),
)
}
Expand Down
213 changes: 0 additions & 213 deletions transport/tuic/congestion/cubic.go

This file was deleted.

Loading

0 comments on commit 828b5ad

Please sign in to comment.