0
0
mirror of https://github.com/hufrea/byedpi.git synced 2025-06-29 18:21:14 +00:00
This commit is contained in:
ruti 2025-05-20 22:37:20 +03:00
parent 13abef7c01
commit c2755ffb0c
2 changed files with 27 additions and 1 deletions

26
main.c
View File

@ -153,6 +153,7 @@ const struct option options[] = {
#ifdef TIMEOUT_SUPPORT
{"timeout", 1, 0, 'T'},
#endif
{"copy", 1, 0, 'B'},
{"proto", 1, 0, 'K'},
{"hosts", 1, 0, 'H'},
{"pf", 1, 0, 'V'},
@ -659,6 +660,8 @@ int main(int argc, char **argv)
char *end = 0;
bool all_limited = 1;
int curr_optind = 1;
struct desync_params *dp = add((void *)&params.dp,
&params.dp_count, sizeof(struct desync_params));
if (!dp) {
@ -668,7 +671,6 @@ int main(int argc, char **argv)
while (!invalid && (rez = getopt_long(
argc, argv, opt, options, 0)) != -1) {
switch (rez) {
case 'N':
@ -762,6 +764,10 @@ int main(int argc, char **argv)
break;
case 'A':
if (optind < curr_optind) {
optind = curr_optind;
continue;
}
if (!(dp->hosts || dp->proto || dp->pf[0] || dp->detect || dp->ipset)) {
all_limited = 0;
}
@ -796,6 +802,24 @@ int main(int argc, char **argv)
if (dp->detect && params.auto_level == AUTO_NOBUFF) {
params.auto_level = AUTO_NOSAVE;
}
dp->_optind = optind;
break;
case 'B':
if (optind < curr_optind) {
continue;
}
if (*optarg == 'i') {
dp->pf[0] = htons(1);
continue;
}
val = strtol(optarg, &end, 0);
if (val < 1 || val >= params.dp_count || *end)
invalid = 1;
else {
curr_optind = optind;
optind = params.dp[val - 1]._optind;
}
break;
case 'u':

View File

@ -105,6 +105,8 @@ struct desync_params {
char *file_ptr;
ssize_t file_size;
int _optind;
};
struct params {