TFE pangu 增加 enable_plugin 配置,可以选择是否启用插件
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
[debug]
|
[debug]
|
||||||
log_level=10
|
log_level=10
|
||||||
|
enable_plugin=1
|
||||||
|
|
||||||
[log]
|
[log]
|
||||||
entrance_id=0
|
entrance_id=0
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ struct pangu_rt
|
|||||||
|
|
||||||
int ctrl_compile_idx;
|
int ctrl_compile_idx;
|
||||||
int ca_store_reseting;
|
int ca_store_reseting;
|
||||||
|
int enable_plugin;
|
||||||
};
|
};
|
||||||
struct pangu_rt * g_pangu_rt;
|
struct pangu_rt * g_pangu_rt;
|
||||||
|
|
||||||
@@ -919,6 +919,11 @@ int pangu_http_init(struct tfe_proxy * proxy)
|
|||||||
int temp=0;
|
int temp=0;
|
||||||
|
|
||||||
g_pangu_rt = ALLOC(struct pangu_rt, 1);
|
g_pangu_rt = ALLOC(struct pangu_rt, 1);
|
||||||
|
MESA_load_profile_int_def(profile_path, "DEBUG", "enable_plugin", &(g_pangu_rt->enable_plugin), 1);
|
||||||
|
if (!g_pangu_rt->enable_plugin)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
g_pangu_rt->thread_num = tfe_proxy_get_work_thread_count();
|
g_pangu_rt->thread_num = tfe_proxy_get_work_thread_count();
|
||||||
g_pangu_rt->gc_evbase=tfe_proxy_get_gc_evbase();
|
g_pangu_rt->gc_evbase=tfe_proxy_get_gc_evbase();
|
||||||
@@ -2548,6 +2553,11 @@ int http_ip_asn_scan(struct Maat_rule_t *result, struct ip_address* sip, struct
|
|||||||
void pangu_on_http_begin(const struct tfe_stream * stream,
|
void pangu_on_http_begin(const struct tfe_stream * stream,
|
||||||
const struct tfe_http_session * session, unsigned int thread_id, void ** pme)
|
const struct tfe_http_session * session, unsigned int thread_id, void ** pme)
|
||||||
{
|
{
|
||||||
|
if (!g_pangu_rt->enable_plugin)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme;
|
struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme;
|
||||||
struct Maat_rule_t result[MAX_SCAN_RESULT];
|
struct Maat_rule_t result[MAX_SCAN_RESULT];
|
||||||
struct ipaddr sapp_addr;
|
struct ipaddr sapp_addr;
|
||||||
@@ -2662,6 +2672,11 @@ static inline int ctx_actually_manipulate(struct pangu_http_ctx * ctx)
|
|||||||
void pangu_on_http_end(const struct tfe_stream * stream,
|
void pangu_on_http_end(const struct tfe_stream * stream,
|
||||||
const struct tfe_http_session * session, unsigned int thread_id, void ** pme)
|
const struct tfe_http_session * session, unsigned int thread_id, void ** pme)
|
||||||
{
|
{
|
||||||
|
if (!g_pangu_rt->enable_plugin)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme;
|
struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme;
|
||||||
size_t i=0, j=0;
|
size_t i=0, j=0;
|
||||||
int ret=0;
|
int ret=0;
|
||||||
@@ -2723,6 +2738,11 @@ void pangu_on_http_end(const struct tfe_stream * stream,
|
|||||||
int pangu_on_http_data(const struct tfe_stream * stream, const struct tfe_http_session * session,
|
int pangu_on_http_data(const struct tfe_stream * stream, const struct tfe_http_session * session,
|
||||||
enum tfe_http_event events, const unsigned char * body_frag, size_t frag_size, unsigned int thread_id, void ** pme)
|
enum tfe_http_event events, const unsigned char * body_frag, size_t frag_size, unsigned int thread_id, void ** pme)
|
||||||
{
|
{
|
||||||
|
if (!g_pangu_rt->enable_plugin)
|
||||||
|
{
|
||||||
|
return CALL_NEXT_PLUGIN;
|
||||||
|
}
|
||||||
|
|
||||||
struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme;
|
struct pangu_http_ctx * ctx = *(struct pangu_http_ctx **) pme;
|
||||||
int ret=0;
|
int ret=0;
|
||||||
if(ctx->resumed_cb)
|
if(ctx->resumed_cb)
|
||||||
|
|||||||
Reference in New Issue
Block a user