SplitHTTP client: Add xmux (multiplex controller) for H3 & H2 (#3613)

https://github.com/XTLS/Xray-core/pull/3613#issuecomment-2351954957

Closes https://github.com/XTLS/Xray-core/issues/3560#issuecomment-2247495778

---------

Co-authored-by: mmmray <142015632+mmmray@users.noreply.github.com>
This commit is contained in:
ll11l1lIllIl1lll 2024-09-16 12:42:01 +00:00 committed by GitHub
parent a931507dd6
commit b1c6471eeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 475 additions and 64 deletions

View file

@ -30,8 +30,7 @@ type DialerClient interface {
// implements splithttp.DialerClient in terms of direct network connections
type DefaultDialerClient struct {
transportConfig *Config
download *http.Client
upload *http.Client
client *http.Client
isH2 bool
isH3 bool
// pool of net.Conn, created using dialUploadConn
@ -80,7 +79,7 @@ func (c *DefaultDialerClient) OpenDownload(ctx context.Context, baseURL string)
req.Header = c.transportConfig.GetRequestHeader()
response, err := c.download.Do(req)
response, err := c.client.Do(req)
gotConn.Close()
if err != nil {
errors.LogInfoInner(ctx, err, "failed to send download http request")
@ -138,7 +137,7 @@ func (c *DefaultDialerClient) SendUploadRequest(ctx context.Context, url string,
req.Header = c.transportConfig.GetRequestHeader()
if c.isH2 || c.isH3 {
resp, err := c.upload.Do(req)
resp, err := c.client.Do(req)
if err != nil {
return err
}