mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-10-27 21:46:58 +00:00
Hysteria: Upgrade to official v2.12.2 (#6565)
https://github.com/XTLS/Xray-core/pull/6565#issuecomment-5202554275 Fixes https://github.com/XTLS/Xray-core/issues/6408 Fixes https://github.com/XTLS/Xray-core/issues/6598 ...
This commit is contained in:
@@ -175,6 +175,7 @@ func createHTTPClient(dest net.Destination, streamSettings *internet.MemoryStrea
|
||||
KeepAlivePeriod: time.Duration(quicParams.KeepAlivePeriod) * time.Second,
|
||||
MaxIncomingStreams: quicParams.MaxIncomingStreams,
|
||||
DisablePathMTUDiscovery: quicParams.DisablePathMtuDiscovery || (runtime.GOOS != "linux" && runtime.GOOS != "windows" && runtime.GOOS != "darwin"),
|
||||
ChromeParrot: !quicParams.DisableChromeParrot,
|
||||
}
|
||||
if quicParams.MaxIdleTimeout == 0 {
|
||||
quicConfig.MaxIdleTimeout = net.ConnIdleTimeout
|
||||
@@ -255,18 +256,25 @@ func createHTTPClient(dest net.Destination, streamSettings *internet.MemoryStrea
|
||||
pktConn = newConn
|
||||
}
|
||||
|
||||
conn, err := quic.DialEarly(ctx, pktConn, udpAddr, tlsCfg, cfg)
|
||||
tr := &quic.Transport{Conn: pktConn, DisableGSO: quicParams.DisableGSO}
|
||||
|
||||
if !quicParams.DisableChromeParrot {
|
||||
tr.ConnectionIDGenerator = quic.ZeroLengthConnectionIDGenerator{}
|
||||
tlsCfg.GetCertificate = nil
|
||||
}
|
||||
|
||||
conn, err := tr.DialEarly(ctx, udpAddr, tlsCfg, cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
context.AfterFunc(conn.Context(), func() { pktConn.Close() })
|
||||
context.AfterFunc(conn.Context(), func() { tr.Close(); pktConn.Close() })
|
||||
|
||||
switch quicParams.Congestion {
|
||||
case "reno":
|
||||
case "", "bbr":
|
||||
congestion.UseBBR(conn, bbr.Profile(quicParams.BbrProfile))
|
||||
case "force-brutal":
|
||||
congestion.UseBrutal(conn, quicParams.BrutalUp)
|
||||
congestion.UseBrutal(conn, quicParams.BrutalUp, quicParams.BrutalDisableLossCompensation)
|
||||
default:
|
||||
panic(quicParams.Congestion)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package splithttp
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
gotls "crypto/tls"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
@@ -506,7 +507,15 @@ func ListenXH(ctx context.Context, address net.Address, port net.Port, streamSet
|
||||
DisablePathMTUDiscovery: quicParams.DisablePathMtuDiscovery || (runtime.GOOS != "linux" && runtime.GOOS != "windows" && runtime.GOOS != "darwin"),
|
||||
}
|
||||
|
||||
l.h3listener, err = quic.ListenEarly(Conn, tlsConfig, quicConfig)
|
||||
var k *quic.StatelessResetKey
|
||||
if !quicParams.DisableStatelessReset {
|
||||
k = &quic.StatelessResetKey{}
|
||||
common.Must2(rand.Read((*k)[:]))
|
||||
}
|
||||
|
||||
tr := &quic.Transport{Conn: Conn, DisableGSO: quicParams.DisableGSO, StatelessResetKey: k}
|
||||
|
||||
l.h3listener, err = tr.ListenEarly(tlsConfig, quicConfig)
|
||||
if err != nil {
|
||||
return nil, errors.New("failed to listen QUIC for XHTTP/3 on ", address, ":", port).Base(err)
|
||||
}
|
||||
@@ -525,6 +534,8 @@ func ListenXH(ctx context.Context, address net.Address, port net.Port, streamSet
|
||||
if err := l.h3server.ServeListener(l.h3listener); err != nil {
|
||||
errors.LogErrorInner(ctx, err, "failed to serve HTTP/3 for XHTTP/3")
|
||||
}
|
||||
_ = tr.Close()
|
||||
_ = Conn.Close()
|
||||
}()
|
||||
} else { // tcp
|
||||
l.listener, err = internet.ListenSystem(ctx, &net.TCPAddr{
|
||||
@@ -622,7 +633,7 @@ func (l *QListener) Accept(ctx context.Context) (*quic.Conn, error) {
|
||||
case "", "bbr":
|
||||
congestion.UseBBR(conn, bbr.Profile(l.quicParams.BbrProfile))
|
||||
case "force-brutal":
|
||||
congestion.UseBrutal(conn, l.quicParams.BrutalUp)
|
||||
congestion.UseBrutal(conn, l.quicParams.BrutalUp, l.quicParams.BrutalDisableLossCompensation)
|
||||
default:
|
||||
panic(l.quicParams.Congestion)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user