mirror of
https://github.com/bol-van/zapret.git
synced 2024-12-02 14:40:52 +03:00
Compare commits
7 Commits
7851f800d1
...
080cbe9c53
Author | SHA1 | Date | |
---|---|---|---|
|
080cbe9c53 | ||
|
1961833348 | ||
|
265120fbce | ||
|
8fccf29e4a | ||
|
ebc2324edf | ||
|
b6fe438017 | ||
|
29fb5f19f2 |
Binary file not shown.
BIN
files/fake/quic_initial_www_google_com.bin
Normal file
BIN
files/fake/quic_initial_www_google_com.bin
Normal file
Binary file not shown.
@ -82,12 +82,10 @@ static void onusr2(int sig)
|
|||||||
printf("\nHOSTFAIL POOL DUMP\n");
|
printf("\nHOSTFAIL POOL DUMP\n");
|
||||||
|
|
||||||
struct desync_profile_list *dpl;
|
struct desync_profile_list *dpl;
|
||||||
int n=0;
|
|
||||||
LIST_FOREACH(dpl, ¶ms.desync_profiles, next)
|
LIST_FOREACH(dpl, ¶ms.desync_profiles, next)
|
||||||
{
|
{
|
||||||
printf("\nDESYNC PROFILE %d\n",n);
|
printf("\nDESYNC PROFILE %d\n",dpl->dp.n);
|
||||||
HostFailPoolDump(dpl->dp.hostlist_auto_fail_counters);
|
HostFailPoolDump(dpl->dp.hostlist_auto_fail_counters);
|
||||||
n++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
@ -1773,7 +1771,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
DLOG_CONDUP("we have %d user defined desync profile(s) and default low priority profile 0\n",desync_profile_count);
|
DLOG_CONDUP("we have %d user defined desync profile(s) and default low priority profile 0\n",desync_profile_count);
|
||||||
|
|
||||||
v=0;
|
|
||||||
LIST_FOREACH(dpl, ¶ms.desync_profiles, next)
|
LIST_FOREACH(dpl, ¶ms.desync_profiles, next)
|
||||||
{
|
{
|
||||||
dp = &dpl->dp;
|
dp = &dpl->dp;
|
||||||
@ -1786,7 +1783,6 @@ int main(int argc, char **argv)
|
|||||||
DLOG("[profile %d] autottl ipv6 %u:%u-%u\n",v,dp->desync_autottl6.delta,dp->desync_autottl6.min,dp->desync_autottl6.max);
|
DLOG("[profile %d] autottl ipv6 %u:%u-%u\n",v,dp->desync_autottl6.delta,dp->desync_autottl6.min,dp->desync_autottl6.max);
|
||||||
if (dp->desync_split_tls==tlspos_none && dp->desync_split_pos) dp->desync_split_tls=tlspos_pos;
|
if (dp->desync_split_tls==tlspos_none && dp->desync_split_pos) dp->desync_split_tls=tlspos_pos;
|
||||||
if (dp->desync_split_http_req==httpreqpos_none && dp->desync_split_pos) dp->desync_split_http_req=httpreqpos_pos;
|
if (dp->desync_split_http_req==httpreqpos_none && dp->desync_split_pos) dp->desync_split_http_req=httpreqpos_pos;
|
||||||
v++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LoadIncludeHostLists())
|
if (!LoadIncludeHostLists())
|
||||||
|
@ -24,12 +24,45 @@ bool IsHttp(const uint8_t *data, size_t len)
|
|||||||
{
|
{
|
||||||
return !!HttpMethod(data,len);
|
return !!HttpMethod(data,len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsHostAt(const uint8_t *p)
|
||||||
|
{
|
||||||
|
return \
|
||||||
|
p[0]=='\n' &&
|
||||||
|
(p[1]=='H' || p[1]=='h') &&
|
||||||
|
(p[2]=='o' || p[2]=='O') &&
|
||||||
|
(p[3]=='s' || p[3]=='S') &&
|
||||||
|
(p[4]=='t' || p[4]=='T') &&
|
||||||
|
p[5]==':';
|
||||||
|
}
|
||||||
|
static uint8_t *FindHostIn(uint8_t *buf, size_t bs)
|
||||||
|
{
|
||||||
|
size_t pos;
|
||||||
|
if (bs<6) return NULL;
|
||||||
|
bs-=6;
|
||||||
|
for(pos=0;pos<=bs;pos++)
|
||||||
|
if (IsHostAt(buf+pos))
|
||||||
|
return buf+pos;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
static const uint8_t *FindHostInConst(const uint8_t *buf, size_t bs)
|
||||||
|
{
|
||||||
|
size_t pos;
|
||||||
|
if (bs<6) return NULL;
|
||||||
|
bs-=6;
|
||||||
|
for(pos=0;pos<=bs;pos++)
|
||||||
|
if (IsHostAt(buf+pos))
|
||||||
|
return buf+pos;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
// pHost points to "Host: ..."
|
// pHost points to "Host: ..."
|
||||||
bool HttpFindHost(uint8_t **pHost,uint8_t *buf,size_t bs)
|
bool HttpFindHost(uint8_t **pHost,uint8_t *buf,size_t bs)
|
||||||
{
|
{
|
||||||
if (!*pHost)
|
if (!*pHost)
|
||||||
{
|
{
|
||||||
*pHost = memmem(buf, bs, "\nHost:", 6);
|
*pHost = FindHostIn(buf, bs);
|
||||||
if (*pHost) (*pHost)++;
|
if (*pHost) (*pHost)++;
|
||||||
}
|
}
|
||||||
return !!*pHost;
|
return !!*pHost;
|
||||||
@ -38,7 +71,7 @@ bool HttpFindHostConst(const uint8_t **pHost,const uint8_t *buf,size_t bs)
|
|||||||
{
|
{
|
||||||
if (!*pHost)
|
if (!*pHost)
|
||||||
{
|
{
|
||||||
*pHost = memmem(buf, bs, "\nHost:", 6);
|
*pHost = FindHostInConst(buf, bs);
|
||||||
if (*pHost) (*pHost)++;
|
if (*pHost) (*pHost)++;
|
||||||
}
|
}
|
||||||
return !!*pHost;
|
return !!*pHost;
|
||||||
@ -132,7 +165,7 @@ bool HttpReplyLooksLikeDPIRedirect(const uint8_t *data, size_t len, const char *
|
|||||||
}
|
}
|
||||||
size_t HttpPos(enum httpreqpos tpos_type, size_t hpos_pos, const uint8_t *http, size_t sz)
|
size_t HttpPos(enum httpreqpos tpos_type, size_t hpos_pos, const uint8_t *http, size_t sz)
|
||||||
{
|
{
|
||||||
const uint8_t *method, *host;
|
const uint8_t *method, *host=NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch(tpos_type)
|
switch(tpos_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user