mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-11 15:16:07 +00:00
feat(mtproto): add domain-fronting and essential mtg options
Expose mtg's [domain-fronting] section (ip/port/proxy-protocol) plus proxy-protocol-listener, prefer-ip, and debug on MTProto inbounds. Each key is written to the generated mtg-<id>.toml only when set, so mtg's own defaults apply otherwise. The instance fingerprint now covers these fields, so editing an option restarts the sidecar. Since MTProto is mtg-served (not Xray), sniffing does not apply: hide the Sniffing tab and the Advanced sniffing sub-editor, drop it from the Advanced "All" JSON view, and emit empty sniffing in the wire payload, all gated by a new canEnableSniffing predicate.
This commit is contained in:
@@ -672,6 +672,174 @@ exports[`protocol capability predicates > mtproto-basic :: xhttp/tls 1`] = `
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: grpc/none 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: grpc/reality 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: grpc/tls 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: httpupgrade/none 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: httpupgrade/tls 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: kcp/none 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: tcp/none 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: tcp/reality 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: tcp/tls 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: ws/none 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: ws/tls 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: xhttp/none 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: xhttp/reality 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > mtproto-domain-fronting :: xhttp/tls 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
"canEnableStream": false,
|
||||
"canEnableTls": false,
|
||||
"canEnableTlsFlow": false,
|
||||
"canEnableVisionSeed": false,
|
||||
"isSS2022": false,
|
||||
"isSSMultiUser": true,
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`protocol capability predicates > shadowsocks-2022 :: grpc/none 1`] = `
|
||||
{
|
||||
"canEnableReality": false,
|
||||
|
||||
@@ -69,6 +69,24 @@ exports[`InboundSettingsSchema fixtures > parses mtproto-basic byte-stably 1`] =
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`InboundSettingsSchema fixtures > parses mtproto-domain-fronting byte-stably 1`] = `
|
||||
{
|
||||
"protocol": "mtproto",
|
||||
"settings": {
|
||||
"debug": true,
|
||||
"domainFronting": {
|
||||
"ip": "127.0.0.1",
|
||||
"port": 9443,
|
||||
"proxyProtocol": true,
|
||||
},
|
||||
"fakeTlsDomain": "www.cloudflare.com",
|
||||
"preferIp": "prefer-ipv4",
|
||||
"proxyProtocolListener": true,
|
||||
"secret": "ee0123456789abcdef0123456789abcdef7777772e636c6f7564666c6172652e636f6d",
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`InboundSettingsSchema fixtures > parses shadowsocks-2022 byte-stably 1`] = `
|
||||
{
|
||||
"protocol": "shadowsocks",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"protocol": "mtproto",
|
||||
"settings": {
|
||||
"fakeTlsDomain": "www.cloudflare.com",
|
||||
"secret": "ee0123456789abcdef0123456789abcdef7777772e636c6f7564666c6172652e636f6d",
|
||||
"proxyProtocolListener": true,
|
||||
"preferIp": "prefer-ipv4",
|
||||
"debug": true,
|
||||
"domainFronting": {
|
||||
"ip": "127.0.0.1",
|
||||
"port": 9443,
|
||||
"proxyProtocol": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,6 +142,17 @@ describe('formValuesToWirePayload', () => {
|
||||
expect(payload.streamSettings).toBe('');
|
||||
});
|
||||
|
||||
it('emits empty sniffing for mtproto (mtg-served, not Xray)', () => {
|
||||
const values = rawInboundToFormValues({
|
||||
...vlessRow,
|
||||
protocol: 'mtproto',
|
||||
settings: { fakeTlsDomain: 'www.cloudflare.com', secret: 'ee00' },
|
||||
});
|
||||
const payload = formValuesToWirePayload(values);
|
||||
expect(payload.protocol).toBe('mtproto');
|
||||
expect(payload.sniffing).toBe('');
|
||||
});
|
||||
|
||||
it('omits nodeId when null', () => {
|
||||
const values = rawInboundToFormValues({ ...vlessRow, nodeId: null });
|
||||
const payload = formValuesToWirePayload(values);
|
||||
|
||||
Reference in New Issue
Block a user