Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sub
diff options
context:
space:
mode:
authormhsanaei <ho3ein.sanaei@gmail.com>2024-06-18 13:49:20 +0300
committermhsanaei <ho3ein.sanaei@gmail.com>2024-06-18 13:49:20 +0300
commit7f2c11220f2d27ac1ad3fdc343b06dd77edd28f1 (patch)
treee7e6b555f6edea2b4848f05e7aa936cb21735b24 /sub
parent52b02fdef9a499efe99b2d32c78a7936fe34d4d6 (diff)
new - splithttp transport
splithttp inbound splithttp outbound change priority host for ws - httpupgrade (host>>headers)
Diffstat (limited to 'sub')
-rw-r--r--sub/subJsonService.go3
-rw-r--r--sub/subService.go130
2 files changed, 78 insertions, 55 deletions
diff --git a/sub/subJsonService.go b/sub/subJsonService.go
index 76d0b126..7b072b95 100644
--- a/sub/subJsonService.go
+++ b/sub/subJsonService.go
@@ -223,8 +223,9 @@ func (s *SubJsonService) streamData(stream string) map[string]interface{} {
streamSettings["wsSettings"] = s.removeAcceptProxy(streamSettings["wsSettings"])
case "httpupgrade":
streamSettings["httpupgradeSettings"] = s.removeAcceptProxy(streamSettings["httpupgradeSettings"])
+ case "splithttp":
+ streamSettings["splithttpSettings"] = s.removeAcceptProxy(streamSettings["splithttpSettings"])
}
-
return streamSettings
}
diff --git a/sub/subService.go b/sub/subService.go
index 3ba0bda7..cc73c6a1 100644
--- a/sub/subService.go
+++ b/sub/subService.go
@@ -202,12 +202,11 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string {
case "ws":
ws, _ := stream["wsSettings"].(map[string]interface{})
obj["path"] = ws["path"].(string)
- obj["host"] = ws["host"].(string)
- if headers, ok := ws["headers"].(map[string]interface{}); ok {
- hostFromHeaders := searchHost(headers)
- if hostFromHeaders != "" {
- obj["host"] = hostFromHeaders
- }
+ if host, ok := ws["host"].(string); ok && len(host) > 0 {
+ obj["host"] = host
+ } else {
+ headers, _ := ws["headers"].(map[string]interface{})
+ obj["host"] = searchHost(headers)
}
case "http":
obj["net"] = "h2"
@@ -230,12 +229,20 @@ func (s *SubService) genVmessLink(inbound *model.Inbound, email string) string {
case "httpupgrade":
httpupgrade, _ := stream["httpupgradeSettings"].(map[string]interface{})
obj["path"] = httpupgrade["path"].(string)
- obj["host"] = httpupgrade["host"].(string)
- if headers, ok := httpupgrade["headers"].(map[string]interface{}); ok {
- hostFromHeaders := searchHost(headers)
- if hostFromHeaders != "" {
- obj["host"] = hostFromHeaders
- }
+ if host, ok := httpupgrade["host"].(string); ok && len(host) > 0 {
+ obj["host"] = host
+ } else {
+ headers, _ := httpupgrade["headers"].(map[string]interface{})
+ obj["host"] = searchHost(headers)
+ }
+ case "splithttp":
+ splithttp, _ := stream["splithttpSettings"].(map[string]interface{})
+ obj["path"] = splithttp["path"].(string)
+ if host, ok := splithttp["host"].(string); ok && len(host) > 0 {
+ obj["host"] = host
+ } else {
+ headers, _ := splithttp["headers"].(map[string]interface{})
+ obj["host"] = searchHost(headers)
}
}
security, _ := stream["security"].(string)
@@ -352,13 +359,11 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
case "ws":
ws, _ := stream["wsSettings"].(map[string]interface{})
params["path"] = ws["path"].(string)
- params["host"] = ws["host"].(string)
- headers, _ := ws["headers"].(map[string]interface{})
- if headers != nil {
- hostFromHeaders := searchHost(headers)
- if hostFromHeaders != "" {
- params["host"] = hostFromHeaders
- }
+ if host, ok := ws["host"].(string); ok && len(host) > 0 {
+ params["host"] = host
+ } else {
+ headers, _ := ws["headers"].(map[string]interface{})
+ params["host"] = searchHost(headers)
}
case "http":
http, _ := stream["httpSettings"].(map[string]interface{})
@@ -380,13 +385,20 @@ func (s *SubService) genVlessLink(inbound *model.Inbound, email string) string {
case "httpupgrade":
httpupgrade, _ := stream["httpupgradeSettings"].(map[string]interface{})
params["path"] = httpupgrade["path"].(string)
- params["host"] = httpupgrade["host"].(string)
- headers, _ := httpupgrade["headers"].(map[string]interface{})
- if headers != nil {
- hostFromHeaders := searchHost(headers)
- if hostFromHeaders != "" {
- params["host"] = hostFromHeaders
- }
+ if host, ok := httpupgrade["host"].(string); ok && len(host) > 0 {
+ params["host"] = host
+ } else {
+ headers, _ := httpupgrade["headers"].(map[string]interface{})
+ params["host"] = searchHost(headers)
+ }
+ case "splithttp":
+ splithttp, _ := stream["splithttpSettings"].(map[string]interface{})
+ params["path"] = splithttp["path"].(string)
+ if host, ok := splithttp["host"].(string); ok && len(host) > 0 {
+ params["host"] = host
+ } else {
+ headers, _ := splithttp["headers"].(map[string]interface{})
+ params["host"] = searchHost(headers)
}
}
security, _ := stream["security"].(string)
@@ -581,13 +593,11 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
case "ws":
ws, _ := stream["wsSettings"].(map[string]interface{})
params["path"] = ws["path"].(string)
- params["host"] = ws["host"].(string)
- headers, _ := ws["headers"].(map[string]interface{})
- if headers != nil {
- hostFromHeaders := searchHost(headers)
- if hostFromHeaders != "" {
- params["host"] = hostFromHeaders
- }
+ if host, ok := ws["host"].(string); ok && len(host) > 0 {
+ params["host"] = host
+ } else {
+ headers, _ := ws["headers"].(map[string]interface{})
+ params["host"] = searchHost(headers)
}
case "http":
http, _ := stream["httpSettings"].(map[string]interface{})
@@ -609,13 +619,20 @@ func (s *SubService) genTrojanLink(inbound *model.Inbound, email string) string
case "httpupgrade":
httpupgrade, _ := stream["httpupgradeSettings"].(map[string]interface{})
params["path"] = httpupgrade["path"].(string)
- params["host"] = httpupgrade["host"].(string)
- headers, _ := httpupgrade["headers"].(map[string]interface{})
- if headers != nil {
- hostFromHeaders := searchHost(headers)
- if hostFromHeaders != "" {
- params["host"] = hostFromHeaders
- }
+ if host, ok := httpupgrade["host"].(string); ok && len(host) > 0 {
+ params["host"] = host
+ } else {
+ headers, _ := httpupgrade["headers"].(map[string]interface{})
+ params["host"] = searchHost(headers)
+ }
+ case "splithttp":
+ splithttp, _ := stream["splithttpSettings"].(map[string]interface{})
+ params["path"] = splithttp["path"].(string)
+ if host, ok := splithttp["host"].(string); ok && len(host) > 0 {
+ params["host"] = host
+ } else {
+ headers, _ := splithttp["headers"].(map[string]interface{})
+ params["host"] = searchHost(headers)
}
}
security, _ := stream["security"].(string)
@@ -811,13 +828,11 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st
case "ws":
ws, _ := stream["wsSettings"].(map[string]interface{})
params["path"] = ws["path"].(string)
- params["host"] = ws["host"].(string)
- headers, _ := ws["headers"].(map[string]interface{})
- if headers != nil {
- hostFromHeaders := searchHost(headers)
- if hostFromHeaders != "" {
- params["host"] = hostFromHeaders
- }
+ if host, ok := ws["host"].(string); ok && len(host) > 0 {
+ params["host"] = host
+ } else {
+ headers, _ := ws["headers"].(map[string]interface{})
+ params["host"] = searchHost(headers)
}
case "http":
http, _ := stream["httpSettings"].(map[string]interface{})
@@ -839,13 +854,20 @@ func (s *SubService) genShadowsocksLink(inbound *model.Inbound, email string) st
case "httpupgrade":
httpupgrade, _ := stream["httpupgradeSettings"].(map[string]interface{})
params["path"] = httpupgrade["path"].(string)
- params["host"] = httpupgrade["host"].(string)
- headers, _ := httpupgrade["headers"].(map[string]interface{})
- if headers != nil {
- hostFromHeaders := searchHost(headers)
- if hostFromHeaders != "" {
- params["host"] = hostFromHeaders
- }
+ if host, ok := httpupgrade["host"].(string); ok && len(host) > 0 {
+ params["host"] = host
+ } else {
+ headers, _ := httpupgrade["headers"].(map[string]interface{})
+ params["host"] = searchHost(headers)
+ }
+ case "splithttp":
+ splithttp, _ := stream["splithttpSettings"].(map[string]interface{})
+ params["path"] = splithttp["path"].(string)
+ if host, ok := splithttp["host"].(string); ok && len(host) > 0 {
+ params["host"] = host
+ } else {
+ headers, _ := splithttp["headers"].(map[string]interface{})
+ params["host"] = searchHost(headers)
}
}