TSG-1531 TFE 新增 DOH 插件
1.DOH 协议解析 2.DOH 协议还原 3.DOH POST请求 early response 4.DOH 策略扫描 5.tfe plugin 支持多个 bussiness 插件调用 6.Maat_feather 的创建从 pangu 剥离(涉及pangu/doh/ssl-policy) 7.增加 kafka 日志 8.增加测试用例
This commit is contained in:
100
plugin/business/doh/src/pub.h
Normal file
100
plugin/business/doh/src/pub.h
Normal file
@@ -0,0 +1,100 @@
|
||||
#ifndef _PUB_H
|
||||
#define _PUB_H
|
||||
|
||||
#ifdef __cpluscplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <event2/buffer.h>
|
||||
#include <tfe_resource.h>
|
||||
#include <tfe_proxy.h>
|
||||
#include <tfe_plugin.h>
|
||||
#include <MESA/Maat_rule.h>
|
||||
#include <MESA/MESA_prof_load.h>
|
||||
#include <tfe_kafka_logger.h>
|
||||
|
||||
#include "dns.h"
|
||||
|
||||
#define MS_OK 0
|
||||
#define MS_ERROR -1
|
||||
|
||||
enum pangu_http_stat
|
||||
{
|
||||
STAT_SESSION,
|
||||
STAT_LOG_NUM,
|
||||
STAT_ACTION_HIJACK,
|
||||
DOH_STAT_MAX
|
||||
};
|
||||
|
||||
enum table_type
|
||||
{
|
||||
TYPE_ADDR,
|
||||
TYPE_APPID,
|
||||
TYPE_QNAME,
|
||||
TYPE_HOST,
|
||||
TYPE_MAX
|
||||
};
|
||||
|
||||
enum doh_content_type
|
||||
{
|
||||
DOH_TYPE_MESSAGE,
|
||||
DOH_TYPE_UDPWIREFORMAT,
|
||||
};
|
||||
|
||||
struct maat_table
|
||||
{
|
||||
int id;
|
||||
char name[TFE_STRING_MAX];
|
||||
};
|
||||
|
||||
struct doh_conf
|
||||
{
|
||||
int enable;
|
||||
int thread_num;
|
||||
|
||||
int local_level;
|
||||
void *local_logger;
|
||||
|
||||
int entry_id;
|
||||
int en_sendlog;
|
||||
const char *device_id;
|
||||
tfe_kafka_logger_t *kafka_logger;
|
||||
|
||||
int fs_id[DOH_STAT_MAX];
|
||||
long long stat_val[DOH_STAT_MAX];
|
||||
struct event *gcev;
|
||||
struct event_base *gc_evbase;
|
||||
screen_stat_handle_t fs_handle;
|
||||
|
||||
Maat_feather_t maat;
|
||||
struct maat_table tables[TYPE_MAX];
|
||||
};
|
||||
|
||||
struct doh_ctx
|
||||
{
|
||||
int count;
|
||||
u_int32_t min_ttl;
|
||||
int thread_id;
|
||||
int magic_num;
|
||||
int manipulate;
|
||||
int opts_num;
|
||||
char *addr_string;
|
||||
size_t result_num;
|
||||
Maat_rule_t *result;
|
||||
cheat_pkt_opt_t *opts;
|
||||
scan_status_t scan_mid;
|
||||
enum doh_content_type type;
|
||||
struct evbuffer *http_req_body;
|
||||
dns_info_t *doh_req;
|
||||
};
|
||||
|
||||
int base64_encode(char *dst, int dstlen, const char *src, int srclen);
|
||||
int base64_decode(char *dst, int dstlen, const char *src, int srclen);
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user