mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-30 01:08:33 +00:00
Add SplitHTTP Transport (#3412)
This commit is contained in:
parent
501d5dec60
commit
c10bd28731
16 changed files with 1288 additions and 19 deletions
52
transport/internet/splithttp/config.go
Normal file
52
transport/internet/splithttp/config.go
Normal file
|
@ -0,0 +1,52 @@
|
|||
package splithttp
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
)
|
||||
|
||||
func (c *Config) GetNormalizedPath() string {
|
||||
path := c.Path
|
||||
if path == "" {
|
||||
path = "/"
|
||||
}
|
||||
if path[0] != '/' {
|
||||
path = "/" + path
|
||||
}
|
||||
if path[len(path)-1] != '/' {
|
||||
path = path + "/"
|
||||
}
|
||||
return path
|
||||
}
|
||||
|
||||
func (c *Config) GetRequestHeader() http.Header {
|
||||
header := http.Header{}
|
||||
for k, v := range c.Header {
|
||||
header.Add(k, v)
|
||||
}
|
||||
return header
|
||||
}
|
||||
|
||||
func (c *Config) GetNormalizedMaxConcurrentUploads() int32 {
|
||||
if c.MaxConcurrentUploads == 0 {
|
||||
return 10
|
||||
}
|
||||
|
||||
return c.MaxConcurrentUploads
|
||||
}
|
||||
|
||||
func (c *Config) GetNormalizedMaxUploadSize() int32 {
|
||||
if c.MaxUploadSize == 0 {
|
||||
return 1000000
|
||||
}
|
||||
|
||||
return c.MaxUploadSize
|
||||
}
|
||||
|
||||
func init() {
|
||||
common.Must(internet.RegisterProtocolConfigCreator(protocolName, func() interface{} {
|
||||
return new(Config)
|
||||
}))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue