mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-12-01 06:08:37 +00:00
Hysteria transport: Proper Brutal behavior; Bump quic-go (#7356)
Fixes https://github.com/XTLS/Xray-core/issues/7353
This commit is contained in:
@@ -3,7 +3,7 @@ module github.com/xtls/xray-core
|
|||||||
go 1.27
|
go 1.27
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/apernet/quic-go v0.61.1-0.20260806010916-184d081eef3e
|
github.com/apernet/quic-go v0.63.1-0.20261004180939-a10df75c260c
|
||||||
github.com/bufbuild/protocompile v0.14.1
|
github.com/bufbuild/protocompile v0.14.1
|
||||||
github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344
|
github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344
|
||||||
github.com/golang/mock v1.7.0-rc.1
|
github.com/golang/mock v1.7.0-rc.1
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
github.com/apernet/quic-go v0.61.1-0.20260806010916-184d081eef3e h1:5mgtR5gwIgBKMiGI1QdXldZZ+SNor06Nbu1wCBulQBg=
|
github.com/apernet/quic-go v0.63.1-0.20261004180939-a10df75c260c h1:cxK8qTA0YCsj68A7zLYDCfPgMTOyt3ePkHh+oXEmYU0=
|
||||||
github.com/apernet/quic-go v0.61.1-0.20260806010916-184d081eef3e/go.mod h1:x7qxEvX6MCVtDuBKHj3E+88+BtrbEMuAL5qGUKItjW8=
|
github.com/apernet/quic-go v0.63.1-0.20261004180939-a10df75c260c/go.mod h1:J7UZVOMF2M1LiE3iiUZWPuy8YCPAcLJOwVURrfJCvc0=
|
||||||
github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw=
|
github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw=
|
||||||
github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c=
|
github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c=
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||||
|
|||||||
@@ -697,10 +697,10 @@ func (c *HttpUpgradeConfig) Build() (proto.Message, error) {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
Byte = 1
|
Byte = 1
|
||||||
Kilobyte = 1024 * Byte
|
Kilobyte = 1000 * Byte
|
||||||
Megabyte = 1024 * Kilobyte
|
Megabyte = 1000 * Kilobyte
|
||||||
Gigabyte = 1024 * Megabyte
|
Gigabyte = 1000 * Megabyte
|
||||||
Terabyte = 1024 * Gigabyte
|
Terabyte = 1000 * Gigabyte
|
||||||
)
|
)
|
||||||
|
|
||||||
type Bandwidth string
|
type Bandwidth string
|
||||||
|
|||||||
@@ -197,7 +197,8 @@ func (c *client) dial(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// udp, _ := strconv.ParseBool(resp.Header.Get(ResponseHeaderUDPEnabled))
|
// udp, _ := strconv.ParseBool(resp.Header.Get(ResponseHeaderUDPEnabled))
|
||||||
down, _ := strconv.ParseUint(resp.Header.Get(CommonHeaderCCRX), 10, 64)
|
remote_rx, _ := strconv.ParseUint(resp.Header.Get(CommonHeaderCCRX), 10, 64)
|
||||||
|
tx := quicParams.BrutalUp
|
||||||
errors.LogDebug(context.Background(), "ECHAccepted ", conn.ConnectionState().TLS.ECHAccepted)
|
errors.LogDebug(context.Background(), "ECHAccepted ", conn.ConnectionState().TLS.ECHAccepted)
|
||||||
|
|
||||||
switch quicParams.Congestion {
|
switch quicParams.Congestion {
|
||||||
@@ -205,10 +206,13 @@ func (c *client) dial(ctx context.Context) error {
|
|||||||
case "bbr":
|
case "bbr":
|
||||||
congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile))
|
congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile))
|
||||||
case "", "brutal":
|
case "", "brutal":
|
||||||
if quicParams.BrutalUp == 0 || down == 0 {
|
if tx == 0 {
|
||||||
congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile))
|
congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile))
|
||||||
} else {
|
} else {
|
||||||
congestion.UseBrutal(conn, min(quicParams.BrutalUp, down), quicParams.BrutalDisableLossCompensation)
|
if remote_rx > 0 {
|
||||||
|
tx = min(tx, remote_rx)
|
||||||
|
}
|
||||||
|
congestion.UseBrutal(conn, tx, quicParams.BrutalDisableLossCompensation)
|
||||||
}
|
}
|
||||||
case "force-brutal":
|
case "force-brutal":
|
||||||
congestion.UseBrutal(conn, quicParams.BrutalUp, quicParams.BrutalDisableLossCompensation)
|
congestion.UseBrutal(conn, quicParams.BrutalUp, quicParams.BrutalDisableLossCompensation)
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ func (h *httpHandler) AuthHTTP(w http.ResponseWriter, r *http.Request) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auth := r.Header.Get(RequestHeaderAuth)
|
auth := r.Header.Get(RequestHeaderAuth)
|
||||||
down, _ := strconv.ParseUint(r.Header.Get(CommonHeaderCCRX), 10, 64)
|
remote_rx, _ := strconv.ParseUint(r.Header.Get(CommonHeaderCCRX), 10, 64)
|
||||||
|
tx := h.quicParams.BrutalUp
|
||||||
|
|
||||||
var user *protocol.MemoryUser
|
var user *protocol.MemoryUser
|
||||||
var ok bool
|
var ok bool
|
||||||
@@ -76,10 +77,13 @@ func (h *httpHandler) AuthHTTP(w http.ResponseWriter, r *http.Request) bool {
|
|||||||
case "bbr":
|
case "bbr":
|
||||||
congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile))
|
congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile))
|
||||||
case "", "brutal":
|
case "", "brutal":
|
||||||
if quicParams.BrutalUp == 0 || down == 0 {
|
if remote_rx == 0 {
|
||||||
congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile))
|
congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile))
|
||||||
} else {
|
} else {
|
||||||
congestion.UseBrutal(conn, min(quicParams.BrutalUp, down), quicParams.BrutalDisableLossCompensation)
|
if tx > 0 {
|
||||||
|
remote_rx = min(remote_rx, tx)
|
||||||
|
}
|
||||||
|
congestion.UseBrutal(conn, remote_rx, quicParams.BrutalDisableLossCompensation)
|
||||||
}
|
}
|
||||||
case "force-brutal":
|
case "force-brutal":
|
||||||
congestion.UseBrutal(conn, quicParams.BrutalUp, quicParams.BrutalDisableLossCompensation)
|
congestion.UseBrutal(conn, quicParams.BrutalUp, quicParams.BrutalDisableLossCompensation)
|
||||||
|
|||||||
Reference in New Issue
Block a user