Files
3x-ui/frontend/src/test/__snapshots__/protocols.test.ts.snap
T
MHSanaei d97bd8643e feat(mtproto): adopt dolonet/mtg-multi and make MTProto inbounds multi-client
Replace the upstream 9seconds/mtg sidecar with the dolonet/mtg-multi fork so a single MTProto inbound can serve many per-user secrets. Each panel client is now one named FakeTLS secret in the fork's [secrets] section: clients are first-class (attach/detach, limits, expiry, per-client tg:// links) exactly like every other protocol, mirroring the WireGuard multi-client model. Per-client traffic and online status come from the fork's /stats JSON API (its Prometheus output has no per-user label), fed into the existing email-keyed client_traffics accumulator; an optional throttle caps concurrent connections. A one-time seeder converts each legacy single-secret inbound into a one-client inbound.

The fork ships only linux/darwin amd64/arm64 binaries but is pure Go, so provisioning builds it from source for every supported platform (release.yml, DockerInit.sh) while keeping the panel-expected mtg-<os>-<arch> filename and the 'run' verb, so process.go is untouched. Also fixes a pre-existing update.sh gap that never renamed the mtg binary for armv6/armv7 updates.
2026-07-06 16:04:32 +02:00

254 lines
5.4 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": {
"clients": [
{
"comment": "",
"email": "mtproto-user",
"enable": true,
"expiryTime": 0,
"limitIp": 0,
"reset": 0,
"secret": "ee0123456789abcdef0123456789abcdef7777772e636c6f7564666c6172652e636f6d",
"subId": "",
"tgId": 0,
"totalGB": 0,
},
],
"fakeTlsDomain": "www.cloudflare.com",
},
}
`;
exports[`InboundSettingsSchema fixtures > parses mtproto-domain-fronting byte-stably 1`] = `
{
"protocol": "mtproto",
"settings": {
"clients": [
{
"comment": "",
"email": "mtproto-user",
"enable": true,
"expiryTime": 0,
"limitIp": 0,
"reset": 0,
"secret": "ee0123456789abcdef0123456789abcdef7777772e636c6f7564666c6172652e636f6d",
"subId": "",
"tgId": 0,
"totalGB": 0,
},
],
"debug": true,
"domainFronting": {
"ip": "127.0.0.1",
"port": 9443,
"proxyProtocol": true,
},
"fakeTlsDomain": "www.cloudflare.com",
"preferIp": "prefer-ipv4",
"proxyProtocolListener": true,
"throttleMaxConnections": 5000,
},
}
`;
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": [
{
"alterId": 0,
"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": {
"clients": [],
"mtu": 1420,
"noKernelTun": false,
"peers": [
{
"allowedIPs": [
"10.0.0.2/32",
],
"keepAlive": 25,
"privateKey": "iJ2cBkrSGqRwIfYIDIxk7hr5RXfdR93MfJUL7yqkkH8=",
"publicKey": "DGSYIcEKAUkA7HhzGSjxLZuV67BR3LeyU0BMLJzNVHQ=",
},
],
"secretKey": "QGVlb2dXc1ZTWGw0ZXBzZndsWmtMaUM5MUlNYjBHWFdYbz0=",
},
}
`;