Skip to content

Commit 1b7f722

Browse files
committed
support splitHTTP
1 parent b661790 commit 1b7f722

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

api/newV2board/model.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,19 @@ type v2ray struct {
3131
Network string `json:"network"`
3232
NetworkSettings struct {
3333
Path string `json:"path"`
34+
Host string `json:"host"`
3435
Headers *json.RawMessage `json:"headers"`
3536
ServiceName string `json:"serviceName"`
3637
Header *json.RawMessage `json:"header"`
3738
} `json:"networkSettings"`
3839
VlessNetworkSettings struct {
3940
Path string `json:"path"`
41+
Host string `json:"host"`
4042
Headers *json.RawMessage `json:"headers"`
4143
ServiceName string `json:"serviceName"`
4244
Header *json.RawMessage `json:"header"`
4345
} `json:"network_settings"`
44-
VlessFlow string `json:"flow"`
46+
VlessFlow string `json:"flow"`
4547
VlessTlsSettings struct {
4648
ServerPort string `json:"server_port"`
4749
Dest string `json:"dest"`

api/newV2board/v2board.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,18 @@ func (c *APIClient) parseV2rayNodeResponse(s *serverConfig) (*api.NodeInfo, erro
413413
header = httpHeader
414414
}
415415
}
416+
case "httpupgrade", "splithttp":
417+
if s.NetworkSettings.Headers != nil {
418+
if httpHeaders, err := s.NetworkSettings.Headers.MarshalJSON(); err != nil {
419+
return nil, err
420+
} else {
421+
b, _ := simplejson.NewJson(httpHeaders)
422+
host = b.Get("Host").MustString()
423+
}
424+
}
425+
if s.NetworkSettings.Host != "" {
426+
host = s.NetworkSettings.Host
427+
}
416428
}
417429

418430
switch s.Tls {

service/controller/inboundbuilder.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ func InboundBuilder(config *Config, nodeInfo *api.NodeInfo, tag string) (*core.I
199199
AcceptProxyProtocol: nodeInfo.AcceptProxyProtocol,
200200
}
201201
streamSetting.HTTPUPGRADESettings = httpupgradeSettings
202+
case "splithttp":
203+
splithttpSetting := &conf.SplitHTTPConfig{
204+
Path: nodeInfo.Path,
205+
Host: nodeInfo.Host,
206+
}
207+
streamSetting.SplitHTTPSettings = splithttpSetting
202208
}
203209
streamSetting.Network = &transportProtocol
204210

0 commit comments

Comments
 (0)