mirror of
https://github.com/hufrea/byedpi.git
synced 2025-01-22 04:02:39 +00:00
auto: remove cl_err alert, add ssl_err
This commit is contained in:
parent
8ad4c22b30
commit
ff17dc424b
15
extend.c
15
extend.c
@ -223,20 +223,11 @@ int on_response(struct poolhd *pool, struct eval *val,
|
|||||||
&& is_http_redirect(req, qn, resp, sn)) {
|
&& is_http_redirect(req, qn, resp, sn)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if ((dp->detect & DETECT_TLS_INVSID)
|
else if ((dp->detect & DETECT_TLS_ERR)
|
||||||
&& neq_tls_sid(req, qn, resp, sn)) {
|
&& ((is_tls_chello(req, qn) && !is_tls_shello(resp, sn))
|
||||||
|
|| neq_tls_sid(req, qn, resp, sn))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if ((dp->detect & DETECT_TLS_ALERT)
|
|
||||||
&& is_tls_alert(resp, sn)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (dp->detect & DETECT_HTTP_CLERR) {
|
|
||||||
int code = get_http_code(resp, sn);
|
|
||||||
if (code > 400 && code < 451 && code != 429) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (m < params.dp_count) {
|
if (m < params.dp_count) {
|
||||||
return reconnect(pool, val, m);
|
return reconnect(pool, val, m);
|
||||||
|
19
main.c
19
main.c
@ -76,8 +76,8 @@ const char help_text[] = {
|
|||||||
#ifdef TCP_FASTOPEN_CONNECT
|
#ifdef TCP_FASTOPEN_CONNECT
|
||||||
" -F, --tfo Enable TCP Fast Open\n"
|
" -F, --tfo Enable TCP Fast Open\n"
|
||||||
#endif
|
#endif
|
||||||
" -A, --auto[=t,r,c,s,a,n] Try desync params after this option\n"
|
" -A, --auto <t,r,s,n> Try desync params after this option\n"
|
||||||
" Detect: torst,redirect,cl_err,sid_inv,alert,none\n"
|
" Detect: torst,redirect,ssl_err,none\n"
|
||||||
" -u, --cache-ttl <sec> Lifetime of cached desync params for IP\n"
|
" -u, --cache-ttl <sec> Lifetime of cached desync params for IP\n"
|
||||||
#ifdef TIMEOUT_SUPPORT
|
#ifdef TIMEOUT_SUPPORT
|
||||||
" -T, --timeout <sec> Timeout waiting for response, after which trigger auto\n"
|
" -T, --timeout <sec> Timeout waiting for response, after which trigger auto\n"
|
||||||
@ -123,7 +123,7 @@ const struct option options[] = {
|
|||||||
#ifdef TCP_FASTOPEN_CONNECT
|
#ifdef TCP_FASTOPEN_CONNECT
|
||||||
{"tfo ", 0, 0, 'F'},
|
{"tfo ", 0, 0, 'F'},
|
||||||
#endif
|
#endif
|
||||||
{"auto", 2, 0, 'A'},
|
{"auto", 1, 0, 'A'},
|
||||||
{"cache-ttl", 1, 0, 'u'},
|
{"cache-ttl", 1, 0, 'u'},
|
||||||
#ifdef TIMEOUT_SUPPORT
|
#ifdef TIMEOUT_SUPPORT
|
||||||
{"timeout", 1, 0, 'T'},
|
{"timeout", 1, 0, 'T'},
|
||||||
@ -542,10 +542,6 @@ int main(int argc, char **argv)
|
|||||||
clear_params();
|
clear_params();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!optarg) {
|
|
||||||
dp->detect |= DETECT_TORST;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
end = optarg;
|
end = optarg;
|
||||||
while (end && !invalid) {
|
while (end && !invalid) {
|
||||||
switch (*end) {
|
switch (*end) {
|
||||||
@ -555,14 +551,9 @@ int main(int argc, char **argv)
|
|||||||
case 'r':
|
case 'r':
|
||||||
dp->detect |= DETECT_HTTP_LOCAT;
|
dp->detect |= DETECT_HTTP_LOCAT;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
|
||||||
dp->detect |= DETECT_HTTP_CLERR;
|
|
||||||
break;
|
|
||||||
case 's':
|
|
||||||
dp->detect |= DETECT_TLS_INVSID;
|
|
||||||
break;
|
|
||||||
case 'a':
|
case 'a':
|
||||||
dp->detect |= DETECT_TLS_ALERT;
|
case 's':
|
||||||
|
dp->detect |= DETECT_TLS_ERR;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
break;
|
break;
|
||||||
|
@ -351,10 +351,11 @@ bool neq_tls_sid(char *req, size_t qn, char *resp, size_t sn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool is_tls_alert(char *resp, size_t sn) {
|
bool is_tls_shello(char *buffer, size_t bsize)
|
||||||
return (sn >= 7
|
{
|
||||||
&& resp[0] == 0x15 && resp[1] == 0x03
|
return (bsize > 5 &&
|
||||||
&& !memcmp(resp + 3, "\x00\x02\x02", 3));
|
ANTOHS(buffer, 0) == 0x1603 &&
|
||||||
|
buffer[5] == 0x02);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -39,7 +39,7 @@ bool is_http_redirect(char *req, size_t qn, char *resp, size_t sn);
|
|||||||
|
|
||||||
bool neq_tls_sid(char *req, size_t qn, char *resp, size_t sn);
|
bool neq_tls_sid(char *req, size_t qn, char *resp, size_t sn);
|
||||||
|
|
||||||
bool is_tls_alert(char *resp, size_t sn);
|
bool is_tls_shello(char *buffer, size_t bsize);
|
||||||
|
|
||||||
int part_tls(char *buffer, size_t bsize, ssize_t n, long pos);
|
int part_tls(char *buffer, size_t bsize, ssize_t n, long pos);
|
||||||
|
|
||||||
|
6
params.h
6
params.h
@ -24,10 +24,8 @@
|
|||||||
#define OFFSET_HOST 2
|
#define OFFSET_HOST 2
|
||||||
|
|
||||||
#define DETECT_HTTP_LOCAT 1
|
#define DETECT_HTTP_LOCAT 1
|
||||||
#define DETECT_HTTP_CLERR 2
|
#define DETECT_TLS_ERR 2
|
||||||
#define DETECT_TLS_INVSID 4
|
#define DETECT_TORST 8
|
||||||
#define DETECT_TLS_ALERT 8
|
|
||||||
#define DETECT_TORST 16
|
|
||||||
|
|
||||||
enum demode {
|
enum demode {
|
||||||
DESYNC_NONE,
|
DESYNC_NONE,
|
||||||
|
Loading…
Reference in New Issue
Block a user