Close #151 解密流量转发使用独立的tableinfo。
This commit is contained in:
@@ -315,8 +315,9 @@ out:
|
||||
#define MAAT_INPUT_REDIS 1
|
||||
#define MAAT_INPUT_FILE 2
|
||||
|
||||
static Maat_feather_t maat_feather_create(const char * instance_name,
|
||||
const char * profile, const char * section, unsigned int max_thread, void * logger)
|
||||
static Maat_feather_t maat_feather_create_with_override(const char * instance_name,
|
||||
const char * profile, const char * section, const char * override_section,
|
||||
unsigned int max_thread, void * logger)
|
||||
{
|
||||
Maat_feather_t target;
|
||||
int input_mode = 0, maat_stat_on = 0, maat_perf_on = 0;
|
||||
@@ -365,6 +366,10 @@ static Maat_feather_t maat_feather_create(const char * instance_name,
|
||||
MESA_load_profile_string_def(profile, section, "stat_file", maat_stat_file, sizeof(maat_stat_file), "");
|
||||
MESA_load_profile_int_def(profile, section, "effect_interval_s", &(effect_interval), 60);
|
||||
|
||||
/* Only override the table info */
|
||||
MESA_load_profile_string_def(profile, override_section, "table_info", table_info, sizeof(table_info), table_info);
|
||||
MESA_load_profile_string_def(profile, override_section, "stat_file", maat_stat_file, sizeof(maat_stat_file), maat_stat_file);
|
||||
|
||||
effect_interval *= 1000;//convert s to ms
|
||||
assert(strlen(inc_cfg_dir) != 0 || strlen(ful_cfg_dir) != 0 || strlen(redis_server) != 0
|
||||
|| strlen(json_cfg_file) != 0);
|
||||
@@ -388,7 +393,6 @@ static Maat_feather_t maat_feather_create(const char * instance_name,
|
||||
break;
|
||||
}
|
||||
|
||||
Maat_set_feather_opt(target, MAAT_OPT_FOREIGN_CONT_DIR, "./pangu_files", strlen("./pangu_files") + 1);
|
||||
if (maat_stat_on)
|
||||
{
|
||||
Maat_set_feather_opt(target, MAAT_OPT_STAT_FILE_PATH, maat_stat_file, strlen(maat_stat_file) + 1);
|
||||
@@ -467,11 +471,8 @@ int traffic_mirror_init(struct tfe_proxy * proxy)
|
||||
struct traffic_mirror_instance * instance = g_traffic_mirror_instance;
|
||||
|
||||
/* Using PANGU-HTTP's profile */
|
||||
const char * profile = "./conf/pangu/pangu_pxy.conf";
|
||||
const char * section = "maat";
|
||||
|
||||
unsigned int is_enable = 1;
|
||||
MESA_load_profile_uint_def(profile, "traffic_mirror", "enable", &is_enable, 1);
|
||||
MESA_load_profile_uint_def("./conf/tfe/tfe.conf", "traffic_mirror", "enable", &is_enable, 1);
|
||||
|
||||
if (!is_enable)
|
||||
{
|
||||
@@ -484,8 +485,9 @@ int traffic_mirror_init(struct tfe_proxy * proxy)
|
||||
instance->nr_threads = tfe_proxy_get_work_thread_count();
|
||||
|
||||
/* MAAT Feather, the configuration is same with pangu-http */
|
||||
instance->maat_feather = maat_feather_create("traffic-mirror", profile, section,
|
||||
instance->nr_threads, instance->logger);
|
||||
instance->maat_feather = maat_feather_create_with_override(
|
||||
"traffic-mirror", "./conf/pangu/pangu_pxy.conf",
|
||||
"maat", "traffic_mirror", instance->nr_threads, instance->logger);
|
||||
|
||||
if (unlikely(!instance->maat_feather))
|
||||
{
|
||||
@@ -534,8 +536,10 @@ int traffic_mirror_init(struct tfe_proxy * proxy)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
errout:
|
||||
return 0;
|
||||
|
||||
errout:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int traffic_mirror_on_open_cb(const struct tfe_stream * stream, unsigned int thread_id,
|
||||
|
||||
Reference in New Issue
Block a user