2023-06-12 07:00:33 +03:00
|
|
|
#include <stdio.h>
|
2024-03-08 03:37:02 +03:00
|
|
|
#include <mpool.h>
|
2024-02-18 23:20:52 +03:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <ws2tcpip.h>
|
|
|
|
#else
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#endif
|
2023-06-12 07:00:33 +03:00
|
|
|
|
2024-03-18 02:23:10 +03:00
|
|
|
#if defined(__linux__) || defined(_WIN32)
|
|
|
|
#define FAKE_SUPPORT 1
|
|
|
|
#define TIMEOUT_SUPPORT 1
|
|
|
|
#endif
|
|
|
|
|
2024-03-05 23:22:12 +03:00
|
|
|
#define OFFSET_SNI 1
|
|
|
|
#define OFFSET_HOST 2
|
|
|
|
|
2023-06-03 22:52:10 +03:00
|
|
|
enum demode {
|
|
|
|
DESYNC_NONE,
|
|
|
|
DESYNC_SPLIT,
|
|
|
|
DESYNC_DISORDER,
|
2024-02-29 20:07:59 +03:00
|
|
|
DESYNC_OOB,
|
2023-06-03 22:52:10 +03:00
|
|
|
DESYNC_FAKE
|
|
|
|
};
|
|
|
|
|
2024-03-21 21:44:17 +03:00
|
|
|
#ifdef STR_MODE
|
|
|
|
char *demode_str[] = {
|
|
|
|
"DESYNC_NONE",
|
|
|
|
"DESYNC_SPLIT",
|
|
|
|
"DESYNC_DISORDER",
|
|
|
|
"DESYNC_OOB",
|
|
|
|
"DESYNC_FAKE"
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2024-03-04 04:49:08 +03:00
|
|
|
struct part {
|
|
|
|
int m;
|
2024-03-05 23:22:12 +03:00
|
|
|
int flag;
|
2024-03-04 04:49:08 +03:00
|
|
|
long pos;
|
|
|
|
};
|
|
|
|
|
2024-03-08 03:37:02 +03:00
|
|
|
struct desync_params {
|
2023-06-03 22:52:10 +03:00
|
|
|
int ttl;
|
2024-03-21 01:01:36 +03:00
|
|
|
char *ip_options;
|
|
|
|
ssize_t ip_options_len;
|
2024-03-05 23:22:12 +03:00
|
|
|
int parts_n;
|
2024-03-04 04:49:08 +03:00
|
|
|
struct part *parts;
|
2023-06-03 22:52:10 +03:00
|
|
|
int mod_http;
|
2024-03-05 23:22:12 +03:00
|
|
|
int tlsrec_n;
|
2024-03-04 15:30:23 +03:00
|
|
|
struct part *tlsrec;
|
2024-03-08 03:37:02 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct params {
|
|
|
|
char de_known;
|
|
|
|
int dp_count;
|
|
|
|
struct desync_params *dp;
|
|
|
|
long sfdelay;
|
2024-03-21 01:01:36 +03:00
|
|
|
char wait_send;
|
2024-03-08 03:37:02 +03:00
|
|
|
int def_ttl;
|
|
|
|
char custom_ttl;
|
2023-06-03 22:52:10 +03:00
|
|
|
|
2024-03-20 02:23:56 +03:00
|
|
|
char tfo;
|
2024-03-13 22:18:16 +03:00
|
|
|
unsigned int timeout;
|
2024-03-08 21:33:25 +03:00
|
|
|
long cache_ttl;
|
2024-03-17 00:19:14 +03:00
|
|
|
int spos_n;
|
|
|
|
struct spos *spos;
|
2023-06-03 22:52:10 +03:00
|
|
|
char ipv6;
|
|
|
|
char resolve;
|
|
|
|
int max_open;
|
|
|
|
int debug;
|
|
|
|
size_t bfsize;
|
2023-10-08 14:43:34 +03:00
|
|
|
struct sockaddr_in6 baddr;
|
2024-03-08 03:37:02 +03:00
|
|
|
struct mphdr *mempool;
|
2023-06-03 22:52:10 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct params params;
|
|
|
|
|
|
|
|
struct packet {
|
2023-10-08 14:43:34 +03:00
|
|
|
ssize_t size;
|
|
|
|
char *data;
|
2023-06-03 22:52:10 +03:00
|
|
|
};
|
|
|
|
extern struct packet fake_tls;
|
|
|
|
extern struct packet fake_http;
|
2024-02-29 20:07:59 +03:00
|
|
|
extern struct packet oob_data;
|
2024-03-17 00:19:14 +03:00
|
|
|
|
|
|
|
struct spos {
|
|
|
|
ssize_t start, end, size;
|
|
|
|
char *data;
|
2024-03-21 21:44:17 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
extern char ip_option[1];
|