mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 09:18:34 +00:00
SplitHTTP server: add ok padding (#3614)
This commit is contained in:
parent
4c82ef8a1b
commit
4b7947cca9
5 changed files with 80 additions and 43 deletions
|
@ -229,10 +229,22 @@ type SplitHTTPConfig struct {
|
|||
Host string `json:"host"`
|
||||
Path string `json:"path"`
|
||||
Headers map[string]string `json:"headers"`
|
||||
ScMaxConcurrentPosts Int32Range `json:"scMaxConcurrentPosts"`
|
||||
ScMaxEachPostBytes Int32Range `json:"scMaxEachPostBytes"`
|
||||
ScMinPostsIntervalMs Int32Range `json:"scMinPostsIntervalMs"`
|
||||
ScMaxConcurrentPosts *Int32Range `json:"scMaxConcurrentPosts"`
|
||||
ScMaxEachPostBytes *Int32Range `json:"scMaxEachPostBytes"`
|
||||
ScMinPostsIntervalMs *Int32Range `json:"scMinPostsIntervalMs"`
|
||||
NoSSEHeader bool `json:"noSSEHeader"`
|
||||
ResponseOkPadding *Int32Range `json:"responseOkPadding"`
|
||||
}
|
||||
|
||||
func splithttpNewRandRangeConfig(input *Int32Range) *splithttp.RandRangeConfig {
|
||||
if input == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &splithttp.RandRangeConfig{
|
||||
From: input.From,
|
||||
To: input.To,
|
||||
}
|
||||
}
|
||||
|
||||
// Build implements Buildable.
|
||||
|
@ -246,22 +258,14 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
|
|||
c.Host = c.Headers["Host"]
|
||||
}
|
||||
config := &splithttp.Config{
|
||||
Path: c.Path,
|
||||
Host: c.Host,
|
||||
Header: c.Headers,
|
||||
ScMaxConcurrentPosts: &splithttp.RandRangeConfig{
|
||||
From: c.ScMaxConcurrentPosts.From,
|
||||
To: c.ScMaxConcurrentPosts.To,
|
||||
},
|
||||
ScMaxEachPostBytes: &splithttp.RandRangeConfig{
|
||||
From: c.ScMaxEachPostBytes.From,
|
||||
To: c.ScMaxEachPostBytes.To,
|
||||
},
|
||||
ScMinPostsIntervalMs: &splithttp.RandRangeConfig{
|
||||
From: c.ScMinPostsIntervalMs.From,
|
||||
To: c.ScMinPostsIntervalMs.To,
|
||||
},
|
||||
NoSSEHeader: c.NoSSEHeader,
|
||||
Path: c.Path,
|
||||
Host: c.Host,
|
||||
Header: c.Headers,
|
||||
ScMaxConcurrentPosts: splithttpNewRandRangeConfig(c.ScMaxConcurrentPosts),
|
||||
ScMaxEachPostBytes: splithttpNewRandRangeConfig(c.ScMaxEachPostBytes),
|
||||
ScMinPostsIntervalMs: splithttpNewRandRangeConfig(c.ScMinPostsIntervalMs),
|
||||
NoSSEHeader: c.NoSSEHeader,
|
||||
ResponseOkPadding: splithttpNewRandRangeConfig(c.ResponseOkPadding),
|
||||
}
|
||||
return config, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue