mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-06 05:05:01 +03:00
1ca5924a44
* feat(mtproto): add MTProto (FakeTLS) protocol via managed mtg sidecar Xray-core has no mtproto proxy, so mtproto inbounds run as standalone mtg (9seconds/mtg) sidecar processes managed by the panel — one per inbound — and are excluded from the generated Xray config entirely. - model: MTProto protocol constant, validator, and FakeTLS secret helpers (GenerateFakeTLSSecret/HealMtprotoSecret) - mtproto package: per-inbound mtg process manager with reconcile, graceful stop, and best-effort Prometheus traffic scraping - runtime: delegate mtproto inbounds to the mtg manager instead of the Xray gRPC API; skip mtproto when building the Xray config - web: boot reconcile + StopAll wiring, periodic reconcile/traffic job, port-conflict transport, secret healing on inbound add/update - sub: tg:// proxy share-link generation - frontend: protocol option, Zod schema, Protocol tab (FakeTLS domain + regenerable secret), info-modal link, and i18n - provisioning: fetch mtg v2.2.8 in install.sh, DockerInit.sh, and the Linux + Windows release workflows * fix * fix * fix: address Copilot review comments on mtproto PR - web/web.go: create NewMtprotoJob once and reuse for cron + initial run - mtproto/manager.go: StopAll cleans up per-inbound config files on shutdown - mtproto/manager.go: CollectTraffic releases mutex before HTTP scrapes to avoid blocking Ensure/Reconcile/Remove during network I/O - database/model/model.go: panic on crypto/rand failure in mtprotoRandomMiddle instead of silently producing a weak all-zero secret - install.sh: fix chmod to handle renamed bin/mtg-linux-arm on armv5/v6/v7
207 lines
4.3 KiB
Plaintext
207 lines
4.3 KiB
Plaintext
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
|
|
exports[`InboundSettingsSchema fixtures > parses http-basic byte-stably 1`] = `
|
|
{
|
|
"protocol": "http",
|
|
"settings": {
|
|
"accounts": [
|
|
{
|
|
"pass": "proxypass",
|
|
"user": "proxyuser",
|
|
},
|
|
{
|
|
"pass": "guest123",
|
|
"user": "guest",
|
|
},
|
|
],
|
|
"allowTransparent": false,
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`InboundSettingsSchema fixtures > parses hysteria-basic byte-stably 1`] = `
|
|
{
|
|
"protocol": "hysteria",
|
|
"settings": {
|
|
"clients": [
|
|
{
|
|
"auth": "hyst3ria-v1-token-XYZ",
|
|
"comment": "legacy v1",
|
|
"email": "hy1-client@example.test",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"limitIp": 0,
|
|
"reset": 0,
|
|
"subId": "hy1-001",
|
|
"tgId": 0,
|
|
"totalGB": 0,
|
|
},
|
|
],
|
|
"version": 1,
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`InboundSettingsSchema fixtures > parses mixed-basic byte-stably 1`] = `
|
|
{
|
|
"protocol": "mixed",
|
|
"settings": {
|
|
"accounts": [
|
|
{
|
|
"pass": "sockspass",
|
|
"user": "socksuser",
|
|
},
|
|
],
|
|
"auth": "password",
|
|
"ip": "127.0.0.1",
|
|
"udp": true,
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`InboundSettingsSchema fixtures > parses mtproto-basic byte-stably 1`] = `
|
|
{
|
|
"protocol": "mtproto",
|
|
"settings": {
|
|
"fakeTlsDomain": "www.cloudflare.com",
|
|
"secret": "ee0123456789abcdef0123456789abcdef7777772e636c6f7564666c6172652e636f6d",
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`InboundSettingsSchema fixtures > parses shadowsocks-2022 byte-stably 1`] = `
|
|
{
|
|
"protocol": "shadowsocks",
|
|
"settings": {
|
|
"clients": [
|
|
{
|
|
"comment": "multi-user shadowsocks 2022",
|
|
"email": "ss-client-1@example.test",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"limitIp": 0,
|
|
"method": "",
|
|
"password": "dGVzdC1jbGllbnQtcGFzc3dvcmQtMQ==",
|
|
"reset": 0,
|
|
"subId": "ssm001",
|
|
"tgId": 0,
|
|
"totalGB": 0,
|
|
},
|
|
],
|
|
"ivCheck": false,
|
|
"method": "2022-blake3-aes-256-gcm",
|
|
"network": "tcp,udp",
|
|
"password": "9oCBhTZxJ5wQa3fLs2vK7nM6pR4tY1uX",
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`InboundSettingsSchema fixtures > parses trojan-basic byte-stably 1`] = `
|
|
{
|
|
"protocol": "trojan",
|
|
"settings": {
|
|
"clients": [
|
|
{
|
|
"comment": "",
|
|
"email": "carol@example.test",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"limitIp": 0,
|
|
"password": "tr0jan-passw0rd-XyZ-123!",
|
|
"reset": 0,
|
|
"subId": "trj001",
|
|
"tgId": 0,
|
|
"totalGB": 0,
|
|
},
|
|
],
|
|
"fallbacks": [],
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`InboundSettingsSchema fixtures > parses tunnel-basic byte-stably 1`] = `
|
|
{
|
|
"protocol": "tunnel",
|
|
"settings": {
|
|
"allowedNetwork": "tcp,udp",
|
|
"followRedirect": false,
|
|
"portMap": {
|
|
"8080": "10.0.0.5:80",
|
|
"8443": "10.0.0.5:443",
|
|
},
|
|
"rewriteAddress": "1.1.1.1",
|
|
"rewritePort": 53,
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`InboundSettingsSchema fixtures > parses vless-tcp-none byte-stably 1`] = `
|
|
{
|
|
"protocol": "vless",
|
|
"settings": {
|
|
"clients": [
|
|
{
|
|
"comment": "",
|
|
"email": "alice@example.test",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"flow": "",
|
|
"id": "8c14d6f7-2e3b-4a91-9d24-3f7a6b8c1e02",
|
|
"limitIp": 0,
|
|
"reset": 0,
|
|
"subId": "abc123def",
|
|
"tgId": 0,
|
|
"totalGB": 0,
|
|
},
|
|
],
|
|
"decryption": "none",
|
|
"encryption": "none",
|
|
"fallbacks": [],
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`InboundSettingsSchema fixtures > parses vmess-basic byte-stably 1`] = `
|
|
{
|
|
"protocol": "vmess",
|
|
"settings": {
|
|
"clients": [
|
|
{
|
|
"comment": "primary tester",
|
|
"email": "bob@example.test",
|
|
"enable": true,
|
|
"expiryTime": 0,
|
|
"id": "c0aa1b9e-4d56-4e8b-9a01-bf2e5d7c4f31",
|
|
"limitIp": 2,
|
|
"reset": 0,
|
|
"security": "auto",
|
|
"subId": "vmess001",
|
|
"tgId": 0,
|
|
"totalGB": 0,
|
|
},
|
|
],
|
|
},
|
|
}
|
|
`;
|
|
|
|
exports[`InboundSettingsSchema fixtures > parses wireguard-basic byte-stably 1`] = `
|
|
{
|
|
"protocol": "wireguard",
|
|
"settings": {
|
|
"mtu": 1420,
|
|
"noKernelTun": false,
|
|
"peers": [
|
|
{
|
|
"allowedIPs": [
|
|
"10.0.0.2/32",
|
|
],
|
|
"keepAlive": 25,
|
|
"privateKey": "iJ2cBkrSGqRwIfYIDIxk7hr5RXfdR93MfJUL7yqkkH8=",
|
|
"publicKey": "DGSYIcEKAUkA7HhzGSjxLZuV67BR3LeyU0BMLJzNVHQ=",
|
|
},
|
|
],
|
|
"secretKey": "QGVlb2dXc1ZTWGw0ZXBzZndsWmtMaUM5MUlNYjBHWFdYbz0=",
|
|
},
|
|
}
|
|
`;
|