@@ -232,6 +232,7 @@ type SplitHTTPConfig struct {
232232 NoSSEHeader bool `json:"noSSEHeader"`
233233 XPaddingBytes * Int32Range `json:"xPaddingBytes"`
234234 Xmux Xmux `json:"xmux"`
235+ DownloadSettings * StreamConfig `json:"downloadSettings"`
235236}
236237
237238type Xmux struct {
@@ -299,6 +300,12 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
299300 XPaddingBytes : splithttpNewRandRangeConfig (c .XPaddingBytes ),
300301 Xmux : & muxProtobuf ,
301302 }
303+ var err error
304+ if c .DownloadSettings != nil {
305+ if config .DownloadSettings , err = c .DownloadSettings .Build (); err != nil {
306+ return nil , errors .New (`Failed to build "downloadSettings".` ).Base (err )
307+ }
308+ }
302309 return config , nil
303310}
304311
@@ -673,7 +680,7 @@ func (p TransportProtocol) Build() (string, error) {
673680 return "grpc" , nil
674681 case "httpupgrade" :
675682 return "httpupgrade" , nil
676- case "splithttp" :
683+ case "xhttp" , " splithttp" :
677684 return "splithttp" , nil
678685 default :
679686 return "" , errors .New ("Config: unknown transport protocol: " , p )
@@ -796,6 +803,8 @@ func (c *SocketConfig) Build() (*internet.SocketConfig, error) {
796803}
797804
798805type StreamConfig struct {
806+ Address * Address `json:"address"`
807+ Port uint16 `json:"port"`
799808 Network * TransportProtocol `json:"network"`
800809 Security string `json:"security"`
801810 TLSSettings * TLSConfig `json:"tlsSettings"`
@@ -808,14 +817,19 @@ type StreamConfig struct {
808817 SocketSettings * SocketConfig `json:"sockopt"`
809818 GRPCConfig * GRPCConfig `json:"grpcSettings"`
810819 HTTPUPGRADESettings * HttpUpgradeConfig `json:"httpupgradeSettings"`
820+ XHTTPSettings * SplitHTTPConfig `json:"xhttpSettings"`
811821 SplitHTTPSettings * SplitHTTPConfig `json:"splithttpSettings"`
812822}
813823
814824// Build implements Buildable.
815825func (c * StreamConfig ) Build () (* internet.StreamConfig , error ) {
816826 config := & internet.StreamConfig {
827+ Port : uint32 (c .Port ),
817828 ProtocolName : "tcp" ,
818829 }
830+ if c .Address != nil {
831+ config .Address = c .Address .Build ()
832+ }
819833 if c .Network != nil {
820834 protocol , err := c .Network .Build ()
821835 if err != nil {
@@ -839,7 +853,7 @@ func (c *StreamConfig) Build() (*internet.StreamConfig, error) {
839853 config .SecurityType = tm .Type
840854 case "reality" :
841855 if config .ProtocolName != "tcp" && config .ProtocolName != "http" && config .ProtocolName != "grpc" && config .ProtocolName != "splithttp" {
842- return nil , errors .New ("REALITY only supports TCP , H2, gRPC and SplitHTTP for now." )
856+ return nil , errors .New ("REALITY only supports RAW , H2, gRPC and XHTTP for now." )
843857 }
844858 if c .REALITYSettings == nil {
845859 return nil , errors .New (`REALITY: Empty "realitySettings".` )
@@ -919,10 +933,13 @@ func (c *StreamConfig) Build() (*internet.StreamConfig, error) {
919933 Settings : serial .ToTypedMessage (hs ),
920934 })
921935 }
936+ if c .XHTTPSettings != nil {
937+ c .SplitHTTPSettings = c .XHTTPSettings
938+ }
922939 if c .SplitHTTPSettings != nil {
923940 hs , err := c .SplitHTTPSettings .Build ()
924941 if err != nil {
925- return nil , errors .New ("Failed to build SplitHTTP config." ).Base (err )
942+ return nil , errors .New ("Failed to build XHTTP config." ).Base (err )
926943 }
927944 config .TransportSettings = append (config .TransportSettings , & internet.TransportConfig {
928945 ProtocolName : "splithttp" ,
0 commit comments