Add multiple sections with config sets for various domains

This commit is contained in:
Vadim Vetrov
2024-10-13 23:31:26 +03:00
parent 58f4802f64
commit 4c7b63fa7f
11 changed files with 450 additions and 413 deletions

View File

@@ -18,11 +18,10 @@ struct instance_config_t {
};
extern struct instance_config_t instance_config;
struct config_t {
unsigned int queue_start_num;
int threads;
int use_gso;
int use_ipv6;
struct section_config_t {
const char *domains_str;
unsigned int domains_strlen;
int fragmentation_strategy;
int frag_sni_reverse;
int frag_sni_faked;
@@ -39,18 +38,13 @@ struct config_t {
#define FAKE_PAYLOAD_DEFAULT 2
int fake_sni_type;
#define VERBOSE_INFO 0
#define VERBOSE_DEBUG 1
#define VERBOSE_TRACE 2
int verbose;
int quic_drop;
#define SNI_DETECTION_PARSE 0
#define SNI_DETECTION_BRUTE 1
int sni_detection;
/* In milliseconds */
unsigned int seg2_delay;
const char *domains_str;
unsigned int domains_strlen;
int synfake;
unsigned int synfake_len;
const char *exclude_domains_str;
unsigned int exclude_domains_strlen;
unsigned int all_domains;
@@ -61,16 +55,42 @@ struct config_t {
const char *fake_custom_pkt;
unsigned int fake_custom_pkt_sz;
unsigned int fk_winsize;
int fakeseq_offset;
#define SNI_DETECTION_PARSE 0
#define SNI_DETECTION_BRUTE 1
int sni_detection;
};
#define MAX_CONFIGLIST_LEN 64
struct config_t {
unsigned int queue_start_num;
int threads;
int use_gso;
int use_ipv6;
unsigned int mark;
int synfake;
unsigned int synfake_len;
#define VERBOSE_INFO 0
#define VERBOSE_DEBUG 1
#define VERBOSE_TRACE 2
int verbose;
struct section_config_t default_config;
struct section_config_t custom_configs[MAX_CONFIGLIST_LEN];
int custom_configs_len;
};
extern struct config_t config;
#define ITER_CONFIG_SECTIONS(section) \
for (struct section_config_t *section = &config.default_config + config.custom_configs_len; section >= &config.default_config; section--)
#define CONFIG_SECTION_NUMBER(section) (int)((section) - &config.default_config)
#define MAX_THREADS 16
#ifndef THREADS_NUM