Run official Xray-core on nodes with full Reality, TLS, and routing.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -162,8 +162,22 @@ func parseInboundForm(r *http.Request, profileID, protocolID uuid.UUID, proto *m
|
||||
RealityPrivateKey: strings.TrimSpace(r.FormValue("reality_private_key")),
|
||||
RealityPublicKey: strings.TrimSpace(r.FormValue("reality_public_key")),
|
||||
RealityShortID: strings.TrimSpace(r.FormValue("reality_short_id")),
|
||||
RealityShortIDs: strings.TrimSpace(r.FormValue("reality_short_ids")),
|
||||
SpiderX: strings.TrimSpace(r.FormValue("spider_x")),
|
||||
SSMethod: strings.TrimSpace(r.FormValue("ss_method")),
|
||||
Password: strings.TrimSpace(r.FormValue("password")),
|
||||
FallbackDest: strings.TrimSpace(r.FormValue("fallback_dest")),
|
||||
FallbacksJSON: strings.TrimSpace(r.FormValue("fallbacks_json")),
|
||||
TLSCertPEM: strings.TrimSpace(r.FormValue("tls_cert_pem")),
|
||||
TLSKeyPEM: strings.TrimSpace(r.FormValue("tls_key_pem")),
|
||||
Sniffing: formCheckbox(r, "sniffing", true),
|
||||
SniffingRouteOnly: formCheckbox(r, "sniffing_route_only", false),
|
||||
}
|
||||
if xver, err := strconv.Atoi(r.FormValue("reality_xver")); err == nil {
|
||||
in.RealityXver = xver
|
||||
}
|
||||
if in.SpiderX == "" {
|
||||
in.SpiderX = "/"
|
||||
}
|
||||
if in.Security == "reality" {
|
||||
priv, pub, sid, dest, names, err := xraykeys.EnsureReality(
|
||||
@@ -175,6 +189,9 @@ func parseInboundForm(r *http.Request, profileID, protocolID uuid.UUID, proto *m
|
||||
}
|
||||
in.RealityPrivateKey, in.RealityPublicKey, in.RealityShortID = priv, pub, sid
|
||||
in.RealityDest, in.RealityServerNames = dest, names
|
||||
if in.RealityShortIDs == "" {
|
||||
in.RealityShortIDs = sid
|
||||
}
|
||||
if in.SNI == "" {
|
||||
in.SNI = strings.Split(names, ",")[0]
|
||||
}
|
||||
@@ -301,6 +318,20 @@ func inboundProtocols(all []models.Protocol) []models.Protocol {
|
||||
return out
|
||||
}
|
||||
|
||||
func formCheckbox(r *http.Request, name string, defaultOn bool) bool {
|
||||
vals := r.Form[name]
|
||||
if len(vals) == 0 {
|
||||
return defaultOn
|
||||
}
|
||||
on := false
|
||||
for _, v := range vals {
|
||||
if v == "on" || v == "true" || v == "1" {
|
||||
on = true
|
||||
}
|
||||
}
|
||||
return on
|
||||
}
|
||||
|
||||
func (s *Server) inboundUpdate(w http.ResponseWriter, r *http.Request) {
|
||||
profileID, err := uuid.Parse(mux.Vars(r)["id"])
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user