Compare commits

..

No commits in common. "ee44aebcc410aa7a6aadf74b795550eaca7c957f" and "3ad029efe0c42e858d61369a49c5d28ce628d609" have entirely different histories.

6 changed files with 21 additions and 59 deletions

View File

@ -1011,15 +1011,6 @@ tpws_curl_test()
echo - checking tpws $3 $4 $5 $6 $7 $8 $9${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"} echo - checking tpws $3 $4 $5 $6 $7 $8 $9${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"}
local ALL_PROXY="socks5://127.0.0.1:$SOCKS_PORT" local ALL_PROXY="socks5://127.0.0.1:$SOCKS_PORT"
ws_curl_test tpws_start "$@"${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"} ws_curl_test tpws_start "$@"${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"}
local code=$?
[ "$code" = 0 ] && {
local testf=$1 dom=$2
shift; shift;
local strategy="$@"
strategy_append_extra_tpws
report_append "ipv${IPV} $dom $testf : tpws ${WF:+$WF }$strategy"
}
return $code
} }
pktws_curl_test() pktws_curl_test()
{ {
@ -1028,26 +1019,7 @@ pktws_curl_test()
# $3,$4,$5, ... - nfqws/dvtws params # $3,$4,$5, ... - nfqws/dvtws params
echo - checking $PKTWSD ${WF:+$WF }$3 $4 $5 $6 $7 $8 $9${PKTWS_EXTRA:+ $PKTWS_EXTRA}${PKTWS_EXTRA_1:+ "$PKTWS_EXTRA_1"}${PKTWS_EXTRA_2:+ "$PKTWS_EXTRA_2"}${PKTWS_EXTRA_3:+ "$PKTWS_EXTRA_3"}${PKTWS_EXTRA_4:+ "$PKTWS_EXTRA_4"}${PKTWS_EXTRA_5:+ "$PKTWS_EXTRA_5"}${PKTWS_EXTRA_6:+ "$PKTWS_EXTRA_6"}${PKTWS_EXTRA_7:+ "$PKTWS_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_EXTRA_6:+ "$PKTWS_EXTRA_6"}${PKTWS_EXTRA_7:+ "$PKTWS_EXTRA_7"}${PKTWS_EXTRA_8:+ "$PKTWS_EXTRA_8"}${PKTWS_EXTRA_9:+ "$PKTWS_EXTRA_9"}
local code=$?
[ "$code" = 0 ] && {
local testf=$1 dom=$2
shift; shift;
local strategy="$@"
strategy_append_extra_pktws
report_append "ipv${IPV} $dom $testf : $PKTWSD ${WF:+$WF }$strategy"
}
return $code
} }
strategy_append_extra_pktws()
{
strategy="${strategy:+$strategy${PKTWS_EXTRA:+ $PKTWS_EXTRA}${PKTWS_EXTRA_1:+ "$PKTWS_EXTRA_1"}${PKTWS_EXTRA_2:+ "$PKTWS_EXTRA_2"}${PKTWS_EXTRA_3:+ "$PKTWS_EXTRA_3"}${PKTWS_EXTRA_4:+ "$PKTWS_EXTRA_4"}${PKTWS_EXTRA_5:+ "$PKTWS_EXTRA_5"}${PKTWS_EXTRA_6:+ "$PKTWS_EXTRA_6"}${PKTWS_EXTRA_7:+ "$PKTWS_EXTRA_7"}${PKTWS_EXTRA_8:+ "$PKTWS_EXTRA_8"}${PKTWS_EXTRA_9:+ "$PKTWS_EXTRA_9"}}"
}
strategy_append_extra_tpws()
{
strategy="${strategy:+$strategy${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"}}"
}
xxxws_curl_test_update() xxxws_curl_test_update()
{ {
# $1 - xxx_curl_test function # $1 - xxx_curl_test function
@ -1099,7 +1071,7 @@ report_strategy()
strategy="$(echo "$strategy" | xargs)" strategy="$(echo "$strategy" | xargs)"
echo "!!!!! $1: working strategy found for ipv${IPV} $2 : $3 $strategy !!!!!" echo "!!!!! $1: working strategy found for ipv${IPV} $2 : $3 $strategy !!!!!"
echo echo
# report_append "ipv${IPV} $2 $1 : $3 ${WF:+$WF }$strategy" report_append "ipv${IPV} $2 $1 : $3 ${WF:+$WF }$strategy"
return 0 return 0
else else
echo "$1: $3 strategy for ipv${IPV} $2 not found" echo "$1: $3 strategy for ipv${IPV} $2 not found"
@ -1342,7 +1314,7 @@ pktws_check_domain_http_bypass()
local strategy local strategy
pktws_check_domain_http_bypass_ "$@" pktws_check_domain_http_bypass_ "$@"
strategy_append_extra_pktws strategy="${strategy:+$strategy${PKTWS_EXTRA:+ $PKTWS_EXTRA}${PKTWS_EXTRA_1:+ "$PKTWS_EXTRA_1"}${PKTWS_EXTRA_2:+ "$PKTWS_EXTRA_2"}${PKTWS_EXTRA_3:+ "$PKTWS_EXTRA_3"}${PKTWS_EXTRA_4:+ "$PKTWS_EXTRA_4"}${PKTWS_EXTRA_5:+ "$PKTWS_EXTRA_5"}${PKTWS_EXTRA_6:+ "$PKTWS_EXTRA_6"}${PKTWS_EXTRA_7:+ "$PKTWS_EXTRA_7"}${PKTWS_EXTRA_8:+ "$PKTWS_EXTRA_8"}${PKTWS_EXTRA_9:+ "$PKTWS_EXTRA_9"}}"
report_strategy $1 $3 $PKTWSD report_strategy $1 $3 $PKTWSD
} }
@ -1387,7 +1359,7 @@ pktws_check_domain_http3_bypass()
local strategy local strategy
pktws_check_domain_http3_bypass_ "$@" pktws_check_domain_http3_bypass_ "$@"
strategy_append_extra_pktws strategy="${strategy:+$strategy $PKTWS_EXTRA $PKTWS_EXTRA_1 $PKTWS_EXTRA_2 $PKTWS_EXTRA_3 $PKTWS_EXTRA_4 $PKTWS_EXTRA_5 $PKTWS_EXTRA_6 $PKTWS_EXTRA_7 $PKTWS_EXTRA_8 $PKTWS_EXTRA_9}"
report_strategy $1 $2 $PKTWSD report_strategy $1 $2 $PKTWSD
} }
warn_mss() warn_mss()
@ -1430,14 +1402,12 @@ tpws_check_domain_http_bypass_()
tpws_curl_test_update $1 $3 $s && [ "$SCANLEVEL" = quick ] && return tpws_curl_test_update $1 $3 $s && [ "$SCANLEVEL" = quick ] && return
done done
else else
local need_mss=1
for mss in '' 88; do for mss in '' 88; do
s3=${mss:+--mss=$mss} s3=${mss:+--mss=$mss}
for s2 in '' '--oob' '--disorder' ${oobdis:+"$oobdis"}; do for s2 in '' '--oob' '--disorder' ${oobdis:+"$oobdis"}; do
for pos in $splits_tls; do for pos in $splits_tls; do
tpws_curl_test_update $1 $3 --split-pos=$pos $s2 $s3 && warn_mss $s3 && [ "$SCANLEVEL" != force ] && { tpws_curl_test_update $1 $3 --split-pos=$pos $s2 $s3 && warn_mss $s3 && [ "$SCANLEVEL" != force ] && {
[ "$SCANLEVEL" = quick ] && return [ "$SCANLEVEL" = quick ] && return
need_mss=0
break break
} }
done done
@ -1446,14 +1416,12 @@ tpws_check_domain_http_bypass_()
for s2 in '--tlsrec=midsld' '--tlsrec=sniext+1 --split-pos=midsld' '--tlsrec=sniext+4 --split-pos=midsld' '--tlsrec=sniext+1 --split-pos=1,midsld' '--tlsrec=sniext+4 --split-pos=1,midsld' ; do for s2 in '--tlsrec=midsld' '--tlsrec=sniext+1 --split-pos=midsld' '--tlsrec=sniext+4 --split-pos=midsld' '--tlsrec=sniext+1 --split-pos=1,midsld' '--tlsrec=sniext+4 --split-pos=1,midsld' ; do
tpws_curl_test_update $1 $3 $s2 $s $s3 && warn_mss $s3 && [ "$SCANLEVEL" != force ] && { tpws_curl_test_update $1 $3 $s2 $s $s3 && warn_mss $s3 && [ "$SCANLEVEL" != force ] && {
[ "$SCANLEVEL" = quick ] && return [ "$SCANLEVEL" = quick ] && return
need_mss=0
break break
} }
done done
done done
# only linux supports mss # only linux supports mss
[ "$UNAME" = Linux -a "$sec" = 1 ] || break [ "$UNAME" = Linux -a "$sec" = 1 ] || break
[ "$SCANLEVEL" = force -o "$need_mss" = 1 ] || break
done done
fi fi
} }
@ -1465,7 +1433,7 @@ tpws_check_domain_http_bypass()
local strategy local strategy
tpws_check_domain_http_bypass_ "$@" tpws_check_domain_http_bypass_ "$@"
strategy_append_extra_tpws strategy="${strategy:+$strategy${TPWS_EXTRA:+ $TPWS_EXTRA}${TPWS_EXTRA_1:+ "$TPWS_EXTRA_1"}${TPWS_EXTRA_2:+ "$TPWS_EXTRA_2"}${TPWS_EXTRA_3:+ "$TPWS_EXTRA_3"}${TPWS_EXTRA_4:+ "$TPWS_EXTRA_4"}${TPWS_EXTRA_5:+ "$TPWS_EXTRA_5"}${TPWS_EXTRA_6:+ "$TPWS_EXTRA_6"}${TPWS_EXTRA_7:+ "$TPWS_EXTRA_7"}${TPWS_EXTRA_8:+ "$TPWS_EXTRA_8"}${TPWS_EXTRA_9:+ "$TPWS_EXTRA_9"}}"
report_strategy $1 $3 tpws report_strategy $1 $3 tpws
} }

BIN
nfq/dvtws

Binary file not shown.

View File

@ -552,7 +552,7 @@ static bool parse_ws_scale_factor(char *s, uint16_t *wsize, uint8_t *wscale)
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
static void cleanup_args() static void cleanup_args()
{ {
wordfree(&params.wexp); wordfree(&params.wexp);
@ -561,7 +561,7 @@ static void cleanup_args()
static void cleanup_params(void) static void cleanup_params(void)
{ {
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
cleanup_args(); cleanup_args();
#endif #endif
@ -985,7 +985,7 @@ static unsigned int hash_jen(const void *data,unsigned int len)
static void exithelp(void) static void exithelp(void)
{ {
printf( printf(
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
" @<config_file>|$<config_file>\t\t\t; read file for options. must be the only argument. other options are ignored.\n\n" " @<config_file>|$<config_file>\t\t\t; read file for options. must be the only argument. other options are ignored.\n\n"
#endif #endif
" --debug=0|1|syslog|@<filename>\n" " --debug=0|1|syslog|@<filename>\n"
@ -1099,7 +1099,7 @@ static void exithelp_clean(void)
exithelp(); exithelp();
} }
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
// no static to not allow optimizer to inline this func (save stack) // no static to not allow optimizer to inline this func (save stack)
void config_from_file(const char *filename) void config_from_file(const char *filename)
{ {
@ -1192,7 +1192,7 @@ int main(int argc, char **argv)
} }
#endif #endif
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$')) if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$'))
{ {
config_from_file(argv[1]+1); config_from_file(argv[1]+1);
@ -1595,13 +1595,7 @@ int main(int argc, char **argv)
dp->split_count++; dp->split_count++;
break; break;
case 26: /* dpi-desync-split-seqovl */ case 26: /* dpi-desync-split-seqovl */
if (!strcmp(optarg,"0")) if (!parse_split_pos(optarg, &dp->seqovl))
{
// allow zero = disable seqovl
dp->seqovl.marker=PM_ABS;
dp->seqovl.pos=0;
}
else if (!parse_split_pos(optarg, &dp->seqovl))
{ {
DLOG_ERR("Invalid argument for dpi-desync-split-seqovl\n"); DLOG_ERR("Invalid argument for dpi-desync-split-seqovl\n");
exit_clean(1); exit_clean(1);
@ -1963,7 +1957,7 @@ int main(int argc, char **argv)
} }
// do not need args from file anymore // do not need args from file anymore
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
cleanup_args(); cleanup_args();
#endif #endif
argv=NULL; argc=0; argv=NULL; argc=0;

View File

@ -14,7 +14,7 @@
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
#include <sys/queue.h> #include <sys/queue.h>
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
#include <wordexp.h> #include <wordexp.h>
#endif #endif
@ -104,7 +104,7 @@ bool dp_list_have_autohostlist(struct desync_profile_list_head *head);
struct params_s struct params_s
{ {
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
wordexp_t wexp; // for file based config wordexp_t wexp; // for file based config
#endif #endif

View File

@ -6,7 +6,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <time.h> #include <time.h>
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
#include <wordexp.h> #include <wordexp.h>
#endif #endif
@ -85,7 +85,7 @@ void dp_list_destroy(struct desync_profile_list_head *head);
struct params_s struct params_s
{ {
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
wordexp_t wexp; // for file based config wordexp_t wexp; // for file based config
#endif #endif

View File

@ -122,7 +122,7 @@ static int get_default_ttl(void)
static void exithelp(void) static void exithelp(void)
{ {
printf( printf(
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
" @<config_file>|$<config_file>\t\t; read file for options. must be the only argument. other options are ignored.\n\n" " @<config_file>|$<config_file>\t\t; read file for options. must be the only argument. other options are ignored.\n\n"
#endif #endif
" --bind-addr=<v4_addr>|<v6_addr>\t; for v6 link locals append %%interface_name\n" " --bind-addr=<v4_addr>|<v6_addr>\t; for v6 link locals append %%interface_name\n"
@ -215,7 +215,7 @@ static void exithelp(void)
); );
exit(1); exit(1);
} }
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
static void cleanup_args() static void cleanup_args()
{ {
wordfree(&params.wexp); wordfree(&params.wexp);
@ -223,7 +223,7 @@ static void cleanup_args()
#endif #endif
static void cleanup_params(void) static void cleanup_params(void)
{ {
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
cleanup_args(); cleanup_args();
#endif #endif
@ -472,7 +472,7 @@ static bool parse_pf_list(char *opt, struct port_filters_head *pfl)
return true; return true;
} }
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
// no static to not allow optimizer to inline this func (save stack) // no static to not allow optimizer to inline this func (save stack)
void config_from_file(const char *filename) void config_from_file(const char *filename)
{ {
@ -547,7 +547,7 @@ void parse_params(int argc, char *argv[])
dp = &dpl->dp; dp = &dpl->dp;
dp->n = ++desync_profile_count; dp->n = ++desync_profile_count;
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$')) if (argc>=2 && (argv[1][0]=='@' || argv[1][0]=='$'))
{ {
config_from_file(argv[1]+1); config_from_file(argv[1]+1);
@ -1288,7 +1288,7 @@ void parse_params(int argc, char *argv[])
SplitDebug(); SplitDebug();
VPRINT("\n"); VPRINT("\n");
#if !defined( __OpenBSD__) && !defined(__ANDROID__) #ifndef __OpenBSD__
// do not need args from file anymore // do not need args from file anymore
cleanup_args(); cleanup_args();
#endif #endif