Dinalmask: Add exp to noise (#902)

* Finalmask: Add "tag" to noise items

* Finalmask: Rename noise "tag" to "exp"

* Finalmask: Move noise "exp" into "type"
This commit is contained in:
Cluvex
2026-10-03 14:11:21 +08:00
committed by GitHub
parent cbc4132383
commit f2b3064153
3 changed files with 39 additions and 3 deletions
+13 -1
View File
@@ -314,10 +314,22 @@ FinalMask 在核心处理完包括 TLS/REALITY 在内的传输层加密后,对
`randRange`: 随机字节范围,默认 0-255。
`type`: `packet` 类型,`array | str | hex | base64`,默认为 array。
`type`: `packet` 类型,`array | str | hex | base64 | exp`,默认为 array。
`packet`: 添加固定数据,与 `rand` 冲突
`type` 为 `exp` 时,`packet` 是一个表达式字符串,由它拼成一个噪声包,每次发送时重新生成,因此可以携带时间戳等变化的内容。表达式的各部分按顺序拼接成一个包:
- `<b hex>`:固定字节,以十六进制书写,可省略的 `0x` 前缀会被忽略
- `<r N>` 或 `<r A-B>`:`N` 个随机字节,或 `A` 到 `B` 之间随机个数
- `<rc N>` 或 `<rc A-B>`:同上,随机字母(`a-zA-Z`)
- `<rd N>` 或 `<rd A-B>`:同上,随机数字(`0-9`)
- `<t>`:当前 Unix 时间(秒),4 字节大端
- `<c>`:计数器,4 字节大端,每次加一
- `<n>`:8 个随机字节
例如 `{"type": "exp", "packet": "<b 0d0a0d0a><t><r 24>"}` 会把 `\r\n\r\n`、时间戳和 24 个随机字节作为一个包发送。
`delay`: 单位毫秒,发送噪声后延迟指定时间后再发下一个。
### salamander
+13 -1
View File
@@ -314,10 +314,22 @@ Noise sent before the actual data.
`randRange`: range of random-byte values. The default is `0-255`.
`type`: the type of `packet`. Supported values are `array`, `str`, `hex`, and `base64`. The default is `array`.
`type`: the type of `packet`. Supported values are `array`, `str`, `hex`, `base64`, and `exp`. The default is `array`.
`packet`: adds fixed data. Conflicts with `rand`.
With `"type": "exp"`, `packet` is an expression string that builds one noise packet, generated again on every send, so it can carry changing content such as a timestamp. The parts of the expression are joined in order into a single packet:
- `<b hex>`: fixed bytes written as hex, an optional `0x` prefix is ignored
- `<r N>` or `<r A-B>`: `N` random bytes, or a random count between `A` and `B`
- `<rc N>` or `<rc A-B>`: the same with random letters (`a-zA-Z`)
- `<rd N>` or `<rd A-B>`: the same with random digits (`0-9`)
- `<t>`: the current Unix time in seconds, 4 bytes big endian
- `<c>`: a counter, 4 bytes big endian, increased by one each time
- `<n>`: 8 random bytes
For example `{"type": "exp", "packet": "<b 0d0a0d0a><t><r 24>"}` sends `\r\n\r\n`, the timestamp and 24 random bytes as one packet.
`delay`: delay in milliseconds. After one noise item is sent, wait for the specified time before sending the next one.
### salamander
+13 -1
View File
@@ -314,10 +314,22 @@ n-й элемент массива задаёт, сколько ждать по
`randRange`: диапазон значений случайных байтов. По умолчанию `0-255`.
`type`: тип `packet`. Поддерживаются `array`, `str`, `hex` и `base64`. Значение по умолчанию - `array`.
`type`: тип `packet`. Поддерживаются `array`, `str`, `hex`, `base64` и `exp`. Значение по умолчанию - `array`.
`packet`: добавляет фиксированные данные. Несовместимо с `rand`.
При `"type": "exp"` `packet` - это строка-выражение, из которой собирается один пакет шума. Он генерируется заново при каждой отправке, поэтому может содержать меняющиеся данные, например метку времени. Части выражения склеиваются по порядку в один пакет:
- `<b hex>`: фиксированные байты в шестнадцатеричном виде, необязательный префикс `0x` игнорируется
- `<r N>` или `<r A-B>`: `N` случайных байтов или случайное количество от `A` до `B`
- `<rc N>` или `<rc A-B>`: то же, случайные буквы (`a-zA-Z`)
- `<rd N>` или `<rd A-B>`: то же, случайные цифры (`0-9`)
- `<t>`: текущее Unix-время в секундах, 4 байта big-endian
- `<c>`: счётчик, 4 байта big-endian, каждый раз увеличивается на единицу
- `<n>`: 8 случайных байтов
Например, `{"type": "exp", "packet": "<b 0d0a0d0a><t><r 24>"}` отправляет `\r\n\r\n`, метку времени и 24 случайных байта одним пакетом.
`delay`: задержка в миллисекундах. После отправки одного элемента шума Xray ждёт указанное время перед отправкой следующего.
### salamander