mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-01 10:45:00 +03:00
dab0add191
* feat(finalmask): support salamander packetSize (Gecko) and realm tlsConfig Hysteria v2.9.1/v2.9.2 added two finalmask features that the pinned Xray-core (26.6.1, 94ffd50) already supports but the panel UI did not expose: Salamander's packetSize range (Gecko, XTLS/Xray-core#6198) and the Realm UDP hole-punching mask's optional tlsConfig (XTLS/Xray-core#6137). Add typed schemas and form fields for both, keeping UdpMaskSchema.settings permissive per the existing finalmask design note. packetSize reuses the existing dash-range preprocess (like udpHop.ports) so it round-trips under the fm= share-link param with no new URI key; realm tlsConfig emits xray's flat TLSConfig shape (serverName/alpn/fingerprint/allowInsecure). Verified against the bundled Xray 26.6.1: configs with packetSize and realm tlsConfig validate (Configuration OK.), plain salamander stays backward-compatible, and a malformed packetSize is correctly rejected by the salamander mask builder. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(finalmask): add snapshots for salamander-gecko and realm-tls fixtures vitest run does not auto-create missing snapshots in CI mode, so the two new fixtures need committed snapshot entries. Verified under node:22 that finalmask.test.ts passes (6/6) with these snapshots. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(finalmask): polished Gecko UX with core-grounded validation Fold PR #5281's Gecko work into the Realm tlsConfig base: - Replace the plain packetSize input with a Salamander/Gecko mode selector and validated Min/Max number inputs. - parseGeckoPacketSize enforces xray-core's real bound (1 <= min <= max <= 2048, the gecko buffer size) so the panel rejects configs core would reject at runtime. - Accurate Gecko description; add parser unit tests. - Drop the unused Salamander/Realm settings schemas; settings stay permissive and are validated at the form level. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Sanaei <ho3ein.sanaei@gmail.com>
235 lines
4.4 KiB
Plaintext
235 lines
4.4 KiB
Plaintext
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
|
|
exports[`FinalMaskStreamSettingsSchema fixtures > parses combined byte-stably 1`] = `
|
|
{
|
|
"quicParams": {
|
|
"brutalDown": "200 mbps",
|
|
"brutalUp": "100 mbps",
|
|
"congestion": "brutal",
|
|
"udpHop": {
|
|
"interval": "5-10",
|
|
"ports": "10000-20000",
|
|
},
|
|
},
|
|
"tcp": [
|
|
{
|
|
"settings": {
|
|
"packets": "1-3",
|
|
},
|
|
"type": "fragment",
|
|
},
|
|
],
|
|
"udp": [
|
|
{
|
|
"settings": {
|
|
"password": "swordfish",
|
|
},
|
|
"type": "salamander",
|
|
},
|
|
{
|
|
"settings": {
|
|
"header": "wireguard",
|
|
"value": "",
|
|
},
|
|
"type": "mkcp-legacy",
|
|
},
|
|
],
|
|
}
|
|
`;
|
|
|
|
exports[`FinalMaskStreamSettingsSchema fixtures > parses quic-params byte-stably 1`] = `
|
|
{
|
|
"quicParams": {
|
|
"bbrProfile": "standard",
|
|
"congestion": "bbr",
|
|
"debug": false,
|
|
"disablePathMTUDiscovery": false,
|
|
"initConnectionReceiveWindow": 20971520,
|
|
"initStreamReceiveWindow": 8388608,
|
|
"keepAlivePeriod": 10,
|
|
"maxConnectionReceiveWindow": 20971520,
|
|
"maxIdleTimeout": 30,
|
|
"maxIncomingStreams": 1024,
|
|
"maxStreamReceiveWindow": 8388608,
|
|
"udpHop": {
|
|
"interval": "5-10",
|
|
"ports": "20000-50000",
|
|
},
|
|
},
|
|
"tcp": [],
|
|
"udp": [],
|
|
}
|
|
`;
|
|
|
|
exports[`FinalMaskStreamSettingsSchema fixtures > parses realm-tls byte-stably 1`] = `
|
|
{
|
|
"tcp": [],
|
|
"udp": [
|
|
{
|
|
"settings": {
|
|
"stunServers": [
|
|
"stun.l.google.com:19302",
|
|
],
|
|
"tlsConfig": {
|
|
"allowInsecure": false,
|
|
"alpn": [
|
|
"h3",
|
|
],
|
|
"fingerprint": "chrome",
|
|
"serverName": "example.com",
|
|
},
|
|
"url": "realm://public@example.com/my-realm",
|
|
},
|
|
"type": "realm",
|
|
},
|
|
],
|
|
}
|
|
`;
|
|
|
|
exports[`FinalMaskStreamSettingsSchema fixtures > parses salamander-gecko byte-stably 1`] = `
|
|
{
|
|
"tcp": [],
|
|
"udp": [
|
|
{
|
|
"settings": {
|
|
"packetSize": "100-200",
|
|
"password": "swordfish",
|
|
},
|
|
"type": "salamander",
|
|
},
|
|
],
|
|
}
|
|
`;
|
|
|
|
exports[`FinalMaskStreamSettingsSchema fixtures > parses tcp-mask byte-stably 1`] = `
|
|
{
|
|
"tcp": [
|
|
{
|
|
"settings": {
|
|
"delay": "5-10",
|
|
"length": "10-20",
|
|
"maxSplit": "0",
|
|
"packets": "1-3",
|
|
},
|
|
"type": "fragment",
|
|
},
|
|
{
|
|
"type": "sudoku",
|
|
},
|
|
{
|
|
"settings": {
|
|
"clients": [
|
|
[
|
|
{
|
|
"delay": 0,
|
|
"packet": [
|
|
"GET / HTTP/1.1",
|
|
],
|
|
"type": "str",
|
|
},
|
|
],
|
|
],
|
|
"errors": [],
|
|
"servers": [
|
|
[
|
|
{
|
|
"delay": 0,
|
|
"packet": [
|
|
"HTTP/1.1 200 OK",
|
|
],
|
|
"type": "str",
|
|
},
|
|
],
|
|
],
|
|
},
|
|
"type": "header-custom",
|
|
},
|
|
],
|
|
"udp": [],
|
|
}
|
|
`;
|
|
|
|
exports[`FinalMaskStreamSettingsSchema fixtures > parses udp-mask byte-stably 1`] = `
|
|
{
|
|
"tcp": [],
|
|
"udp": [
|
|
{
|
|
"settings": {
|
|
"password": "swordfish",
|
|
},
|
|
"type": "salamander",
|
|
},
|
|
{
|
|
"settings": {
|
|
"header": "",
|
|
"value": "abcdef0123456789",
|
|
},
|
|
"type": "mkcp-legacy",
|
|
},
|
|
{
|
|
"settings": {
|
|
"header": "dns",
|
|
"value": "cloudflare.com",
|
|
},
|
|
"type": "mkcp-legacy",
|
|
},
|
|
{
|
|
"settings": {
|
|
"header": "wireguard",
|
|
"value": "",
|
|
},
|
|
"type": "mkcp-legacy",
|
|
},
|
|
{
|
|
"settings": {
|
|
"noise": [
|
|
{
|
|
"delay": "10-16",
|
|
"rand": "10-20",
|
|
"type": "rand",
|
|
},
|
|
{
|
|
"delay": "5",
|
|
"packet": [
|
|
"ping",
|
|
],
|
|
"type": "str",
|
|
},
|
|
],
|
|
"reset": "60",
|
|
},
|
|
"type": "noise",
|
|
},
|
|
{
|
|
"settings": {
|
|
"domains": [
|
|
"example.com:txt",
|
|
"example.org:a",
|
|
],
|
|
"resolvers": [
|
|
"example.com:txt+udp://1.1.1.1:53",
|
|
],
|
|
},
|
|
"type": "xdns",
|
|
},
|
|
{
|
|
"settings": {
|
|
"dgram": false,
|
|
"ips": [],
|
|
},
|
|
"type": "xicmp",
|
|
},
|
|
{
|
|
"settings": {
|
|
"stunServers": [
|
|
"stun.l.google.com:19302",
|
|
"global.stun.twilio.com:3478",
|
|
],
|
|
"url": "realm://public@example.com/my-realm",
|
|
},
|
|
"type": "realm",
|
|
},
|
|
],
|
|
}
|
|
`;
|