mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-14 18:09:05 +00:00
XHTTP transport: Add "bbr" (default) and "force-brutal" congestion control for H3 (#5711)
https://github.com/XTLS/Xray-core/pull/5711#issuecomment-3984037632
This commit is contained in:
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/xtls/xray-core/common/signal/done"
|
||||
"github.com/xtls/xray-core/common/uuid"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
"github.com/xtls/xray-core/transport/internet/hysteria/congestion"
|
||||
"github.com/xtls/xray-core/transport/internet/browser_dialer"
|
||||
"github.com/xtls/xray-core/transport/internet/reality"
|
||||
"github.com/xtls/xray-core/transport/internet/stat"
|
||||
@@ -195,7 +196,23 @@ func createHTTPClient(dest net.Destination, streamSettings *internet.MemoryStrea
|
||||
}
|
||||
}
|
||||
|
||||
return quic.DialEarly(ctx, udpConn, udpAddr, tlsCfg, cfg)
|
||||
quicConn, err := quic.DialEarly(ctx, udpConn, udpAddr, tlsCfg, cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if streamSettings.QuicParams != nil {
|
||||
switch streamSettings.QuicParams.Congestion {
|
||||
case "force-brutal":
|
||||
congestion.UseBrutal(quicConn, streamSettings.QuicParams.Up)
|
||||
case "reno":
|
||||
// quic-go default, do nothing
|
||||
default:
|
||||
congestion.UseBBR(quicConn)
|
||||
}
|
||||
} else {
|
||||
congestion.UseBBR(quicConn)
|
||||
}
|
||||
return quicConn, nil
|
||||
},
|
||||
}
|
||||
} else if httpVersion == "2" {
|
||||
|
||||
Reference in New Issue
Block a user