From 242e9197e5f6264ec3501c3c9c393573e439e9a6 Mon Sep 17 00:00:00 2001 From: Yaroslav Gurov Date: Mon, 12 Jan 2026 22:09:48 +0000 Subject: [PATCH] readme: reformat tags formatting guide --- README.md | 163 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 134 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 79cbb7e..d28cfd7 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ Value as a tag-sequence, as described in Tag format paragraph - **Example** `FormatIn = ` ### Format of output -- A format of packet which AWG device would generate on the output side instead of the original WG packet. The whole packet would be generated as a single piece and would be sent to the system as-is +A format of packet which AWG device would generate on the output side instead of the original WG packet. The whole packet would be generated as a single piece and would be sent to the system as-is - **Format** `FormatOut = [fmt]` - `[fmt]` is a tag-sequence specified in Tags format section - **Example** `FormatOut = ` @@ -137,43 +137,148 @@ Value as a tag-sequence, as described in Tag format paragraph ## Tags format ### Static bytes tag -- Adds specified bytes as is to the packet -- **Format** ` -- **Param** `[seq]` is a hex-encoded sequence of bytes (2 hex numbers per byte). *always even-sized* -- **Example** `` + +**Description** +- Static bytes, sends and receives specified bytes as-is with predictable size +- Immutable, does not change after configuration + +**Format** +``` + +``` + +**Params** +- `[seq]` - *always even-sized* hex-encoded sequence of bytes (2 hex numbers per byte) + +**Sample usage** +``` + + +``` ### Random bytes tag -- Adds the specified amount of randomly-generated bytes to the packet -- **Format** `` -- `[size]` is the amount of bytes -- **Example** `` + +**Description** +- Randomly-generated bytes of specified size +- Uses cryptographically secure generator + +**Format** +``` + +``` + +**Params** +- `[size]` - amount of random bytes + +**Sample usage** +``` + + +``` ### Random digits tag -- Adds the specified amount of randomly-generated digits from `[0-9]` set to the packet -- **Format** `` -- `[size]` is the amount of digits -- **Example** `` + +**Description** +- Randomly-generated digits from `[0-9]` set +- Uses cryptographically secure generator + +**Format** +``` + +``` + +**Params** +- `[size]` - amount of digits + +**Sample usage** +``` + + +``` ### Random characters tag -- Adds the specified amount of randomly-generated digits from `[a-zA-Z]` to the packet -- **Format** `` -- `[size]` is the amount of chars -- **Example** `` + +**Description** +- Randomly-generated digits from `[a-zA-Z]` set +- Uses cryptographically secure generator + +**Format** +``` + +``` + +**Params** +- `[size]` - amount of chars + +**Example** +``` + + +``` ### Timestamp tag -- Adds current UNIX time (4 bytes) to the packet -- **Format** `` + +**Description** +- Current UNIX time, int32 +- Provided in big-endian + +**Format** +``` + +``` + +**Sample usage** +``` + + +``` ### Data tag -- Adds original wireguard data to the packet -- **Format** `` + +**Description** +- The original WireGuard packet +- Has `H1-H4` and `S1-S4` params applied + +**Format** +``` + +``` + +**Sample usage** +``` + + +``` ### Data size tag -- Adds a size of the current original wireguard data to the packet -- **Variant 1** `` -- `[fmt]` could be `be` or `le` meaning `big-endian` and `little-endian` accordingly -- `[size]` is the amount of bytes a value take -- **Example** `` would put `int32` value in `big-endian` format -- **Variant 2** `` -- `[fmt]` could be `ascii` or `hex`. `ascii` converts `int(10)`-> `"10"`, and `hex` converts `int(10)` -> `"A"`. size of this field is dynamic. has no leading zeroes -- `[end]` is the static symbol which is following the size. sender would also apply it to the packet + +**Description** +- Size of the remaining pard of original WireGuard packet +- `hex` and `ascii` formats are dynamic-sized and no leading zeroes +- sender appends `[end]` to the end in case of `ascii` or `hex` + +**Format** +``` + +``` + +**Params** +- `[fmt]` - format of the field + - `be` - fixed-size big-endian + - `le` - fixed-size little-endian + - `ascii` - decimal ascii representation + - `hex` - hexadecimal ASCII representation +- `[size]` - amount of bytes of the field + - only for `be` and `le` +- `[end]` - the symbol following the data size + - only for `ascii` and `hex` + +**Sample usage** +``` + e.g. `10 -> "10\r"` + e.g. `10 -> "A\n"` + e.g. `10 -> 0x00 0x00 0x00 0x0A` + e.g. `10 -> 0x0A 0x00` + + +```