Browse Source

chore: address review nits for split-pos file support

Co-authored-by: vemneyy <[email protected]>
pull/2093/head
copilot-swe-agent[bot] 4 months ago
parent
commit
31b93cc3e1
  1. 2
      docs/readme.en.md
  2. 6
      nfq/nfqws.c

2
docs/readme.en.md

@ -442,7 +442,7 @@ When splitting all markers are resolved to absolute offsets. If a relative posit
In `multisplit`or `multidisorder` case split is cancelled if no position remained.
`fakedsplit` и `fakeddisorder` use only one split position. It's searched from the `--dpi-desync-split-pos` list by a special alorightm.
`fakedsplit` и `fakeddisorder` use only one split position. It's searched from the `--dpi-desync-split-pos` list by a special algorithm.
If split positions were loaded from `@file`, one position is randomly selected from that file list for each fake packet.
First relative markers are searched. If no suitable found absolute markers are searched. If nothing found position 1 is used.

6
nfq/nfqws.c

@ -1206,7 +1206,7 @@ static bool load_split_pos_file(const char *filename, struct proto_pos *splits,
DLOG_PERROR("fopen split-pos file");
return false;
}
char line[256], *p, *end;
char line[256], *p, *trim_pos;
int line_num = 0;
*split_count = 0;
while (fgets(line, sizeof(line), f))
@ -1221,8 +1221,8 @@ static bool load_split_pos_file(const char *filename, struct proto_pos *splits,
if ((p = strchr(line, '\r'))) *p = 0;
for (p = line; *p == ' ' || *p == '\t'; p++);
if (!*p || *p == '#') continue;
end = p + strlen(p) - 1;
while (end > p && (*end == ' ' || *end == '\t')) *end-- = 0;
trim_pos = p + strlen(p) - 1;
while (trim_pos > p && (*trim_pos == ' ' || *trim_pos == '\t')) *trim_pos-- = 0;
if (!parse_split_pos(p, splits + *split_count))
{
DLOG_ERR("split-pos file %s line %d: invalid split pos: %s\n", filename, line_num, p);

Loading…
Cancel
Save