diff --git a/go.mod b/go.mod index aa5694ca5..a944589ae 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/xtls/xray-core go 1.27 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/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 github.com/golang/mock v1.7.0-rc.1 diff --git a/go.sum b/go.sum index a69efbe5b..dbc096b39 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/apernet/quic-go v0.61.1-0.20260806010916-184d081eef3e h1:5mgtR5gwIgBKMiGI1QdXldZZ+SNor06Nbu1wCBulQBg= -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 h1:cxK8qTA0YCsj68A7zLYDCfPgMTOyt3ePkHh+oXEmYU0= +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/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= diff --git a/infra/conf/transport_method.go b/infra/conf/transport_method.go index 826d074fd..78f463a2c 100644 --- a/infra/conf/transport_method.go +++ b/infra/conf/transport_method.go @@ -697,10 +697,10 @@ func (c *HttpUpgradeConfig) Build() (proto.Message, error) { const ( Byte = 1 - Kilobyte = 1024 * Byte - Megabyte = 1024 * Kilobyte - Gigabyte = 1024 * Megabyte - Terabyte = 1024 * Gigabyte + Kilobyte = 1000 * Byte + Megabyte = 1000 * Kilobyte + Gigabyte = 1000 * Megabyte + Terabyte = 1000 * Gigabyte ) type Bandwidth string diff --git a/transport/internet/hysteria/dialer.go b/transport/internet/hysteria/dialer.go index a6eed34c6..dc424932a 100644 --- a/transport/internet/hysteria/dialer.go +++ b/transport/internet/hysteria/dialer.go @@ -197,7 +197,8 @@ func (c *client) dial(ctx context.Context) error { } // 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) switch quicParams.Congestion { @@ -205,10 +206,13 @@ func (c *client) dial(ctx context.Context) error { case "bbr": congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile)) case "", "brutal": - if quicParams.BrutalUp == 0 || down == 0 { + if tx == 0 { congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile)) } 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": congestion.UseBrutal(conn, quicParams.BrutalUp, quicParams.BrutalDisableLossCompensation) diff --git a/transport/internet/hysteria/hub.go b/transport/internet/hysteria/hub.go index 441db8744..c2e45c1f9 100644 --- a/transport/internet/hysteria/hub.go +++ b/transport/internet/hysteria/hub.go @@ -55,7 +55,8 @@ func (h *httpHandler) AuthHTTP(w http.ResponseWriter, r *http.Request) bool { } 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 ok bool @@ -76,10 +77,13 @@ func (h *httpHandler) AuthHTTP(w http.ResponseWriter, r *http.Request) bool { case "bbr": congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile)) case "", "brutal": - if quicParams.BrutalUp == 0 || down == 0 { + if remote_rx == 0 { congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile)) } 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": congestion.UseBrutal(conn, quicParams.BrutalUp, quicParams.BrutalDisableLossCompensation)