Skip to content

Commit

Permalink
为V2RaySocks的transports增加SplitHTTP和HTTPUpgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
theresaarcher committed Jul 21, 2024
1 parent 01f1827 commit efb8e52
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions api/v2raysocks/v2raysocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,12 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
case "ws":
path = inboundInfo.Get("streamSettings").Get("wsSettings").Get("path").MustString()
host = inboundInfo.Get("streamSettings").Get("wsSettings").Get("headers").Get("Host").MustString()
case "httpupgrade":
host = inboundInfo.Get("streamSettings").Get("httpupgradeSettings").Get("Host").MustString()
path = inboundInfo.Get("streamSettings").Get("httpupgradeSettings").Get("path").MustString()
case "splithttp":
host = inboundInfo.Get("streamSettings").Get("splithttpSettings").Get("Host").MustString()
path = inboundInfo.Get("streamSettings").Get("splithttpSettings").Get("path").MustString()
case "grpc":
if data, ok := inboundInfo.Get("streamSettings").Get("grpcSettings").CheckGet("serviceName"); ok {
serviceName = data.MustString()
Expand All @@ -449,12 +455,11 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
header = httpHeader
}
}

}

enableTLS = inboundInfo.Get("streamSettings").Get("security").MustString() == "tls"
enableVless = inboundInfo.Get("streamSettings").Get("security").MustString() == "reality"
enableReality = enableVless
enableVless = inboundInfo.Get("protocol").MustString() == "vless"
enableReality = inboundInfo.Get("streamSettings").Get("security").MustString() == "reality"

realityConfig := new(api.REALITYConfig)
if enableVless {
Expand All @@ -472,10 +477,8 @@ func (c *APIClient) ParseV2rayNodeResponse(nodeInfoResponse *simplejson.Json) (*
}

// XTLS only supports TLS and REALITY directly for now
if (transportProtocol == "h2" || transportProtocol == "grpc") && enableReality {
vlessFlow = ""
} else {
vlessFlow = c.VlessFlow
if transportProtocol == "tcp" && enableReality {
vlessFlow = "xtls-rprx-vision"
}

// Create GeneralNodeInfo
Expand Down

0 comments on commit efb8e52

Please sign in to comment.