mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-01 01:44:15 +00:00
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:
parent
a931507dd6
commit
b1c6471eeb
9 changed files with 475 additions and 64 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue