Run official Xray-core on nodes with full Reality, TLS, and routing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
orohi
2026-07-29 05:41:11 +03:00
co-authored by Cursor
parent b48b936c27
commit c567693651
13 changed files with 831 additions and 325 deletions
+41 -4
View File
@@ -101,7 +101,10 @@ func scanInbound(scanner interface {
&in.Port, &in.Network, &in.Security, &in.Listen, &in.Enabled, &in.SortOrder, &in.Remark,
&in.Path, &in.Host, &in.SNI, &in.Fingerprint, &in.Flow, &in.ALPN,
&in.RealityDest, &in.RealityServerNames, &in.RealityPrivateKey, &in.RealityPublicKey, &in.RealityShortID,
&in.RealityShortIDs, &in.SpiderX, &in.RealityXver,
&in.SSMethod, &in.Password,
&in.FallbackDest, &in.FallbacksJSON, &in.TLSCertPEM, &in.TLSKeyPEM,
&in.Sniffing, &in.SniffingRouteOnly,
&in.CreatedAt, &in.UpdatedAt,
)
if err != nil {
@@ -115,7 +118,10 @@ i.id, i.profile_id, i.tag, i.protocol_id, p.code, p.name,
i.port, i.network, i.security, i.listen, i.enabled, i.sort_order, i.remark,
i.path, i.host, i.sni, i.fingerprint, i.flow, i.alpn,
i.reality_dest, i.reality_server_names, i.reality_private_key, i.reality_public_key, i.reality_short_id,
i.reality_short_ids, i.spider_x, i.reality_xver,
i.ss_method, i.password,
i.fallback_dest, i.fallbacks_json, i.tls_cert_pem, i.tls_key_pem,
i.sniffing, i.sniffing_route_only,
i.created_at, i.updated_at`
func ListInboundsByProfile(db *sql.DB, profileID uuid.UUID) ([]models.Inbound, error) {
@@ -175,6 +181,12 @@ func CreateInbound(db *sql.DB, in *models.Inbound) error {
if in.SSMethod == "" {
in.SSMethod = "aes-128-gcm"
}
if in.SpiderX == "" {
in.SpiderX = "/"
}
if in.RealityShortIDs == "" && in.RealityShortID != "" {
in.RealityShortIDs = in.RealityShortID
}
now := time.Now().UTC()
in.CreatedAt = now
in.UpdatedAt = now
@@ -183,18 +195,27 @@ INSERT INTO inbounds (
id, profile_id, tag, protocol_id, port, network, security, listen, enabled, sort_order, remark,
path, host, sni, fingerprint, flow, alpn,
reality_dest, reality_server_names, reality_private_key, reality_public_key, reality_short_id,
ss_method, password, created_at, updated_at
reality_short_ids, spider_x, reality_xver,
ss_method, password,
fallback_dest, fallbacks_json, tls_cert_pem, tls_key_pem,
sniffing, sniffing_route_only, created_at, updated_at
) VALUES (
$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,
$12,$13,$14,$15,$16,$17,
$18,$19,$20,$21,$22,
$23,$24,$25,$26
$23,$24,$25,
$26,$27,
$28,$29,$30,$31,
$32,$33,$34,$35
)`,
in.ID, in.ProfileID, in.Tag, in.ProtocolID, in.Port, in.Network, in.Security, in.Listen,
in.Enabled, in.SortOrder, in.Remark,
in.Path, in.Host, in.SNI, in.Fingerprint, in.Flow, in.ALPN,
in.RealityDest, in.RealityServerNames, in.RealityPrivateKey, in.RealityPublicKey, in.RealityShortID,
in.SSMethod, in.Password, in.CreatedAt, in.UpdatedAt,
in.RealityShortIDs, in.SpiderX, in.RealityXver,
in.SSMethod, in.Password,
in.FallbackDest, in.FallbacksJSON, in.TLSCertPEM, in.TLSKeyPEM,
in.Sniffing, in.SniffingRouteOnly, in.CreatedAt, in.UpdatedAt,
)
return err
}
@@ -206,20 +227,33 @@ func UpdateInbound(db *sql.DB, in *models.Inbound) error {
if in.SSMethod == "" {
in.SSMethod = "aes-128-gcm"
}
if in.SpiderX == "" {
in.SpiderX = "/"
}
if in.RealityShortIDs == "" && in.RealityShortID != "" {
in.RealityShortIDs = in.RealityShortID
}
_, err := db.Exec(`
UPDATE inbounds SET
tag = $2, protocol_id = $3, port = $4, network = $5, security = $6,
listen = $7, enabled = $8, sort_order = $9, remark = $10,
path = $11, host = $12, sni = $13, fingerprint = $14, flow = $15, alpn = $16,
reality_dest = $17, reality_server_names = $18, reality_private_key = $19,
reality_public_key = $20, reality_short_id = $21, ss_method = $22, password = $23,
reality_public_key = $20, reality_short_id = $21,
reality_short_ids = $22, spider_x = $23, reality_xver = $24,
ss_method = $25, password = $26,
fallback_dest = $27, fallbacks_json = $28, tls_cert_pem = $29, tls_key_pem = $30,
sniffing = $31, sniffing_route_only = $32,
updated_at = NOW()
WHERE id = $1`,
in.ID, in.Tag, in.ProtocolID, in.Port, in.Network, in.Security,
in.Listen, in.Enabled, in.SortOrder, in.Remark,
in.Path, in.Host, in.SNI, in.Fingerprint, in.Flow, in.ALPN,
in.RealityDest, in.RealityServerNames, in.RealityPrivateKey, in.RealityPublicKey, in.RealityShortID,
in.RealityShortIDs, in.SpiderX, in.RealityXver,
in.SSMethod, in.Password,
in.FallbackDest, in.FallbacksJSON, in.TLSCertPEM, in.TLSKeyPEM,
in.Sniffing, in.SniffingRouteOnly,
)
return err
}
@@ -308,7 +342,10 @@ ORDER BY i.sort_order ASC, i.tag ASC`, nodeID, *n.ProfileID)
&in.Port, &in.Network, &in.Security, &in.Listen, &in.Enabled, &in.SortOrder, &in.Remark,
&in.Path, &in.Host, &in.SNI, &in.Fingerprint, &in.Flow, &in.ALPN,
&in.RealityDest, &in.RealityServerNames, &in.RealityPrivateKey, &in.RealityPublicKey, &in.RealityShortID,
&in.RealityShortIDs, &in.SpiderX, &in.RealityXver,
&in.SSMethod, &in.Password,
&in.FallbackDest, &in.FallbacksJSON, &in.TLSCertPEM, &in.TLSKeyPEM,
&in.Sniffing, &in.SniffingRouteOnly,
&in.CreatedAt, &in.UpdatedAt, &in.NodeEnabled,
); err != nil {
return nil, err