XHTTP: Add "stream-one" mode for client & server (#4071)

""Breaking"": Client uses "stream-one" mode by default when using **REALITY** ("stream-up" if "downloadSettings" exists)
This commit is contained in:
RPRX 2024-11-27 20:19:18 +00:00 committed by GitHub
parent d8934cf839
commit f7bd98b13c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 141 additions and 25 deletions

View file

@ -307,7 +307,7 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
switch c.Mode {
case "":
c.Mode = "auto"
case "auto", "packet-up", "stream-up":
case "auto", "packet-up", "stream-up", "stream-one":
default:
return nil, errors.New("unsupported mode: " + c.Mode)
}
@ -327,6 +327,9 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
}
var err error
if c.DownloadSettings != nil {
if c.Mode == "stream-one" {
return nil, errors.New(`Can not use "downloadSettings" in "stream-one" mode.`)
}
if c.Extra != nil {
c.DownloadSettings.SocketSettings = nil
}
@ -707,8 +710,10 @@ func (p TransportProtocol) Build() (string, error) {
case "ws", "websocket":
return "websocket", nil
case "h2", "h3", "http":
errors.PrintDeprecatedFeatureWarning("HTTP transport", "XHTTP transport")
return "http", nil
case "grpc":
errors.PrintMigrateFeatureInfo("gRPC transport", "XHTTP transport")
return "grpc", nil
case "httpupgrade":
return "httpupgrade", nil