mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-01 01:44:15 +00:00
SplitHTTP: Rename three options & Reduce server defaults (#3611)
* maxUploadSize -> scMaxEachPostBytes, default is 1MB on both sides (was 2MB on the server) * minUploadIntervalMs -> scMinPostsIntervalMs, default is 30ms on the client (no server support for now) * maxConcurrentUploads -> scMaxConcurrentPosts, default is 100 on both sides (was 200 on the server)
This commit is contained in:
parent
33daa0c94b
commit
30af792777
6 changed files with 85 additions and 99 deletions
|
@ -181,9 +181,9 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||
transportConfiguration := streamSettings.ProtocolSettings.(*Config)
|
||||
tlsConfig := tls.ConfigFromStreamSettings(streamSettings)
|
||||
|
||||
maxConcurrentUploads := transportConfiguration.GetNormalizedMaxConcurrentUploads(false)
|
||||
maxUploadSize := transportConfiguration.GetNormalizedMaxUploadSize(false)
|
||||
minUploadInterval := transportConfiguration.GetNormalizedMinUploadInterval()
|
||||
scMaxConcurrentPosts := transportConfiguration.GetNormalizedScMaxConcurrentPosts()
|
||||
scMaxEachPostBytes := transportConfiguration.GetNormalizedScMaxEachPostBytes()
|
||||
scMinPostsIntervalMs := transportConfiguration.GetNormalizedScMinPostsIntervalMs()
|
||||
|
||||
if tlsConfig != nil {
|
||||
requestURL.Scheme = "https"
|
||||
|
@ -201,10 +201,10 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||
|
||||
httpClient := getHTTPClient(ctx, dest, streamSettings)
|
||||
|
||||
uploadPipeReader, uploadPipeWriter := pipe.New(pipe.WithSizeLimit(maxUploadSize.roll()))
|
||||
uploadPipeReader, uploadPipeWriter := pipe.New(pipe.WithSizeLimit(scMaxEachPostBytes.roll()))
|
||||
|
||||
go func() {
|
||||
requestsLimiter := semaphore.New(int(maxConcurrentUploads.roll()))
|
||||
requestsLimiter := semaphore.New(int(scMaxConcurrentPosts.roll()))
|
||||
var requestCounter int64
|
||||
|
||||
lastWrite := time.Now()
|
||||
|
@ -239,8 +239,8 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
|||
}
|
||||
}()
|
||||
|
||||
if minUploadInterval.From > 0 {
|
||||
roll := time.Duration(minUploadInterval.roll()) * time.Millisecond
|
||||
if scMinPostsIntervalMs.From > 0 {
|
||||
roll := time.Duration(scMinPostsIntervalMs.roll()) * time.Millisecond
|
||||
if time.Since(lastWrite) < roll {
|
||||
time.Sleep(roll)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue