mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-12 17:05:01 +03:00
b04039c2bd
xray-core v26.10.10 serves MASQUE: CONNECT-IP over HTTP/3 or HTTP/2, always behind TLS, as an inbound and an outbound protocol riding a dedicated "masque" transport. The panel could not create either. Inbound: MASQUE is a multi-user protocol whose users log in with their email and password over Basic auth. The panel keeps the client's "password" like trojan and GenXrayInboundConfig hands it to the core as "pass", so the full-config path, the live AddInbound path and node pushes all emit what the core reads; one user with an empty pass makes the core refuse the whole inbound. Live user adds build a masque.Account from either key, client-only changes diff per user so a new client does not drop every connected tunnel, and client creation, copy, validation and edits key on the password. The address pool and MTU get form fields, TLS is mandatory, and the port check follows the core's listener choice: HTTP/2 on TCP when the ALPN offers h2, HTTP/3 on UDP when it offers h3 or not h2. Nodes may host MASQUE from v3.9.1, the first panel release that knows to rename the password. MASQUE has no share-link format, so links and Clash skip it; the JSON subscription builds the client's masque outbound with its email and password, and the subscription allowlist now lets a subId see MASQUE inbounds at all. The IP-limit job, client pages and traffic tracking list the protocol. Outbound: the form edits the server, remote DNS, and the transport's host, path, Basic credentials, headers and WARP block (enrolled key, endpoint public key, tunnel addresses), which xray-core refuses next to user/pass. The outbound test probes it through the core, since its default HTTP/3 dial is UDP.
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package service
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/mhsanaei/3x-ui/v3/internal/database"
|
|
"github.com/mhsanaei/3x-ui/v3/internal/database/model"
|
|
)
|
|
|
|
// MASQUE is native Xray, so a node runs it, but a node panel older than the release
|
|
// that knows it would hand the clients' "password" to a core that reads "pass".
|
|
func TestCheckNodeCanHostProtocol_Masque(t *testing.T) {
|
|
setupConflictDB(t)
|
|
tests := []struct {
|
|
version string
|
|
wantErr string
|
|
}{
|
|
{"v3.9.0", "need v3.9.1 or newer"},
|
|
{"v3.9.1", ""},
|
|
{"dev+1d1128cf", ""},
|
|
}
|
|
for i, tc := range tests {
|
|
t.Run(tc.version, func(t *testing.T) {
|
|
node := &model.Node{Name: "masque-node-" + tc.version, Address: "127.0.0.1", Port: 2096 + i, PanelVersion: tc.version}
|
|
if err := database.GetDB().Create(node).Error; err != nil {
|
|
t.Fatalf("create node: %v", err)
|
|
}
|
|
err := checkNodeCanHostProtocol(database.GetDB(), node.Id, model.MASQUE)
|
|
if tc.wantErr == "" {
|
|
if err != nil {
|
|
t.Fatalf("node on %s refused MASQUE: %v", tc.version, err)
|
|
}
|
|
return
|
|
}
|
|
if err == nil || !strings.Contains(err.Error(), tc.wantErr) {
|
|
t.Fatalf("node on %s: err = %v, want one containing %q", tc.version, err, tc.wantErr)
|
|
}
|
|
})
|
|
}
|
|
}
|