2024-08-10 23:10:18 +00:00
|
|
|
#ifndef YTB_CONFIG_H
|
|
|
|
#define YTB_CONFIG_H
|
|
|
|
|
|
|
|
typedef int (*raw_send_t)(const unsigned char *data, unsigned int data_len);
|
|
|
|
/**
|
|
|
|
* Sends the packet after delay_ms. The function should schedule send and return immediately
|
|
|
|
* (for example, open daemon thread)
|
|
|
|
*/
|
|
|
|
typedef void (*delayed_send_t)(const unsigned char *data, unsigned int data_len, unsigned int delay_ms);
|
|
|
|
|
|
|
|
struct instance_config_t {
|
|
|
|
raw_send_t send_raw_packet;
|
|
|
|
delayed_send_t send_delayed_packet;
|
|
|
|
};
|
|
|
|
extern struct instance_config_t instance_config;
|
2024-08-07 10:32:01 +00:00
|
|
|
|
|
|
|
struct config_t {
|
|
|
|
unsigned int queue_start_num;
|
|
|
|
int threads;
|
|
|
|
int use_gso;
|
|
|
|
int fragmentation_strategy;
|
2024-08-10 23:10:18 +00:00
|
|
|
int frag_sni_reverse;
|
|
|
|
int frag_sni_faked;
|
|
|
|
int faking_strategy;
|
|
|
|
unsigned char faking_ttl;
|
|
|
|
int fake_sni;
|
|
|
|
unsigned int fake_sni_seq_len;
|
2024-08-13 17:48:35 +00:00
|
|
|
#define VERBOSE_INFO 0
|
|
|
|
#define VERBOSE_DEBUG 1
|
|
|
|
#define VERBOSE_TRACE 2
|
2024-08-07 10:32:01 +00:00
|
|
|
int verbose;
|
2024-08-13 17:48:35 +00:00
|
|
|
int quic_drop;
|
2024-08-14 23:31:48 +00:00
|
|
|
#define SNI_DETECTION_PARSE 0
|
|
|
|
#define SNI_DETECTION_BRUTE 1
|
|
|
|
int sni_detection;
|
2024-08-10 23:10:18 +00:00
|
|
|
/* In milliseconds */
|
2024-08-07 10:32:01 +00:00
|
|
|
unsigned int seg2_delay;
|
2024-08-08 12:29:04 +00:00
|
|
|
const char *domains_str;
|
|
|
|
unsigned int domains_strlen;
|
|
|
|
unsigned int all_domains;
|
2024-08-11 12:34:58 +00:00
|
|
|
const char *fake_sni_pkt;
|
|
|
|
unsigned int fake_sni_pkt_sz;
|
2024-08-11 21:45:30 +00:00
|
|
|
unsigned int fk_winsize;
|
2024-08-07 10:32:01 +00:00
|
|
|
};
|
2024-08-10 23:10:18 +00:00
|
|
|
|
2024-08-07 10:32:01 +00:00
|
|
|
extern struct config_t config;
|
|
|
|
|
2024-08-03 23:20:09 +00:00
|
|
|
#define MAX_THREADS 16
|
|
|
|
|
|
|
|
#ifndef THREADS_NUM
|
|
|
|
#define THREADS_NUM 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if THREADS_NUM > MAX_THREADS
|
|
|
|
#error "Too much threads"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef NOUSE_GSO
|
|
|
|
#define USE_GSO
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FRAG_STRAT_TCP 0
|
|
|
|
#define FRAG_STRAT_IP 1
|
|
|
|
#define FRAG_STRAT_NONE 2
|
|
|
|
|
2024-08-05 20:37:45 +00:00
|
|
|
#ifndef FRAGMENTATION_STRATEGY
|
2024-08-03 23:20:09 +00:00
|
|
|
#define FRAGMENTATION_STRATEGY FRAG_STRAT_TCP
|
2024-08-05 20:37:45 +00:00
|
|
|
#endif
|
2024-08-03 23:20:09 +00:00
|
|
|
|
|
|
|
#define RAWSOCKET_MARK (1 << 15)
|
|
|
|
|
|
|
|
#ifdef USE_SEG2_DELAY
|
|
|
|
#define SEG2_DELAY 100
|
|
|
|
#endif
|
|
|
|
|
2024-08-10 23:10:18 +00:00
|
|
|
#define FAKE_TTL 8
|
2024-08-07 00:31:10 +00:00
|
|
|
|
2024-08-10 23:10:18 +00:00
|
|
|
// Will invalidate fake packets by out-of-ack_seq out-of-seq request
|
2024-08-16 19:47:55 +00:00
|
|
|
#define FAKE_STRAT_RAND_SEQ 1
|
2024-08-10 23:10:18 +00:00
|
|
|
// Will assume that GGC server is located further than FAKE_TTL
|
|
|
|
// Thus, Fake packet will be eliminated automatically.
|
2024-08-16 19:47:55 +00:00
|
|
|
#define FAKE_STRAT_TTL 2
|
|
|
|
#define FAKE_STRAT_PAST_SEQ 3
|
|
|
|
#define FAKE_STRAT_TCP_CHECK 4
|
2024-08-07 00:31:10 +00:00
|
|
|
|
2024-08-05 20:13:35 +00:00
|
|
|
|
2024-08-10 23:10:18 +00:00
|
|
|
#ifndef FAKING_STRATEGY
|
2024-08-16 19:47:55 +00:00
|
|
|
#define FAKING_STRATEGY FAKE_STRAT_RAND_SEQ
|
2024-08-05 20:37:45 +00:00
|
|
|
#endif
|
2024-08-05 20:13:35 +00:00
|
|
|
|
2024-08-04 12:55:07 +00:00
|
|
|
#if !defined(SILENT) && !defined(KERNEL_SPACE)
|
2024-08-03 23:20:09 +00:00
|
|
|
#define DEBUG
|
|
|
|
#endif
|
2024-08-04 12:55:07 +00:00
|
|
|
|
2024-08-06 21:22:52 +00:00
|
|
|
// The Maximum Transmission Unit size for rawsocket
|
|
|
|
// Larger packets will be fragmented. Applicable for Chrome's kyber.
|
2024-08-14 23:31:48 +00:00
|
|
|
#define AVAILABLE_MTU 1500
|
2024-08-08 12:29:04 +00:00
|
|
|
|
2024-08-10 18:38:25 +00:00
|
|
|
#define DEFAULT_QUEUE_NUM 537
|
|
|
|
|
2024-08-10 23:10:18 +00:00
|
|
|
#define MAX_PACKET_SIZE 8192
|
|
|
|
|
2024-08-08 21:05:28 +00:00
|
|
|
static const char defaul_snistr[] = "googlevideo.com,ggpht.com,ytimg.com,youtube.com,play.google.com,youtu.be,googleapis.com,googleusercontent.com,gstatic.com,l.google.com";
|
2024-08-10 23:10:18 +00:00
|
|
|
|
|
|
|
#endif /* YTB_CONFIG_H */
|