TSG Master 共享部分扫描结果给 TFE
* TSG-2847 - TFE 新增 cmsg 共享 TSG Master 的扫描结果 * TSG-2851 - Pangu 从 cmsg 获取 TSG Master 的扫描结果 * TSG-2852 - DOH 从 cmsg 获取 TSG Master 的扫描结果 * TSG-2849 - TFE DOH 功能支持 SUBID * 合并 pangu/doh 的 maat scan 的代码为 tfe_scan
This commit is contained in:
@@ -29,18 +29,18 @@ enum tfe_cmsg_tlv_type
|
||||
TFE_CMSG_POLICY_ID = 0x10,
|
||||
TFE_CMSG_STREAM_TRACE_ID = 0x11,
|
||||
|
||||
TFE_CMSG_SSL_INTERCEPT_STATE, //size uint64_t, 0-passthrough, 1-intercept, 2-shutdown, referer from enum ssl_stream_action
|
||||
TFE_CMSG_SSL_SERVER_SIDE_LATENCY, //size uint64_t, milisecond
|
||||
TFE_CMSG_SSL_CLIENT_SIDE_LATENCY, //size uint64_t, milisecond
|
||||
TFE_CMSG_SSL_SERVER_SIDE_VERSION, //string, SSLv3 TLSv1 TLSv1.1 TLSv1.2 TLSv1.3 unknown
|
||||
TFE_CMSG_SSL_CLIENT_SIDE_VERSION,
|
||||
TFE_CMSG_SSL_PINNING_STATE, //size uint64_t, 0-not pinning 1-pinning 2-maybe pinning
|
||||
TFE_CMSG_SSL_CERT_VERIFY,
|
||||
TFE_CMSG_SSL_ERROR, //string
|
||||
TFE_CMSG_SSL_INTERCEPT_STATE, //size uint64_t, 0-passthrough, 1-intercept, 2-shutdown, referer from enum ssl_stream_action
|
||||
TFE_CMSG_SSL_SERVER_SIDE_LATENCY, //size uint64_t, milisecond
|
||||
TFE_CMSG_SSL_CLIENT_SIDE_LATENCY, //size uint64_t, milisecond
|
||||
TFE_CMSG_SSL_SERVER_SIDE_VERSION, //string, SSLv3 TLSv1 TLSv1.1 TLSv1.2 TLSv1.3 unknown
|
||||
TFE_CMSG_SSL_CLIENT_SIDE_VERSION,
|
||||
TFE_CMSG_SSL_PINNING_STATE, //size uint64_t, 0-not pinning 1-pinning 2-maybe pinning
|
||||
TFE_CMSG_SSL_CERT_VERIFY,
|
||||
TFE_CMSG_SSL_ERROR, //string
|
||||
|
||||
/* Original Traffic's src & dst MAC address */
|
||||
TFE_CMSG_SRC_MAC,
|
||||
TFE_CMSG_DST_MAC,
|
||||
/* Original Traffic's src & dst MAC address */
|
||||
TFE_CMSG_SRC_MAC,
|
||||
TFE_CMSG_DST_MAC,
|
||||
|
||||
/* TCP option information */
|
||||
TFE_CMSG_DOWNSTREAM_TCP_NODELAY,
|
||||
@@ -61,6 +61,22 @@ enum tfe_cmsg_tlv_type
|
||||
|
||||
TFE_CMSG_TCP_PASSTHROUGH,
|
||||
|
||||
/* Share tsg scan result */
|
||||
TFE_CMSG_SRC_SUB_ID, // string max size 256
|
||||
TFE_CMSG_DST_SUB_ID, // string max size 256
|
||||
TFE_CMSG_SRC_ASN, // string max size 64
|
||||
TFE_CMSG_DST_ASN, // string max size 64
|
||||
TFE_CMSG_SRC_ORGANIZATION, // string max size 256
|
||||
TFE_CMSG_DST_ORGANIZATION, // string max size 256
|
||||
TFE_CMSG_SRC_IP_LOCATION_COUNTRY, // string max size 256
|
||||
TFE_CMSG_DST_IP_LOCATION_COUNTRY, // string max size 256
|
||||
TFE_CMSG_SRC_IP_LOCATION_PROVINE, // string max size 256
|
||||
TFE_CMSG_DST_IP_LOCATION_PROVINE, // string max size 256
|
||||
TFE_CMSG_SRC_IP_LOCATION_CITY, // string max size 256
|
||||
TFE_CMSG_DST_IP_LOCATION_CITY, // string max size 256
|
||||
|
||||
/* Add new cmsg here */
|
||||
/* Add new cmsg here */
|
||||
/* Add new cmsg here */
|
||||
|
||||
/* MAX cmsg num */
|
||||
|
||||
@@ -3,40 +3,20 @@
|
||||
enum RESOURCE_TYPE
|
||||
{
|
||||
STATIC_MAAT,
|
||||
DYNAMINC_MAAT,
|
||||
KAFKA_LOGGER,
|
||||
DEVICE_ID,
|
||||
};
|
||||
|
||||
enum TABLE_TYPE
|
||||
{
|
||||
TABLE_IP_ASN_USER_DEFINED,
|
||||
TABLE_IP_ASN_BUILT_IN,
|
||||
TABLE_IP_LOCATION_USER_DEFINED,
|
||||
TABLE_IP_LOCATION_BUILT_IN,
|
||||
TABLE_SECURITY_SOURCE_ASN,
|
||||
TABLE_SECURITY_DESTINATION_ASN,
|
||||
TABLE_SECURITY_SOURCE_LOCATION,
|
||||
TABLE_SECURITY_DESTINATION_LOCATION,
|
||||
TABLE_OBJ_SUBSCRIBER_ID,
|
||||
TABLE_TYPE_MAX
|
||||
};
|
||||
|
||||
struct ip_data_table
|
||||
{
|
||||
int profile_id;
|
||||
int ref_cnt;
|
||||
|
||||
char *asn;
|
||||
char *organization;
|
||||
|
||||
char *country_full;
|
||||
char *province_full;
|
||||
char *city_full;
|
||||
|
||||
pthread_mutex_t lock;
|
||||
};
|
||||
|
||||
int tfe_bussiness_resouce_init();
|
||||
void *tfe_bussiness_resouce_get(enum RESOURCE_TYPE type);
|
||||
int tfe_bussiness_tableid_get(enum TABLE_TYPE type);
|
||||
void ip_table_free(struct ip_data_table *ip_asn);
|
||||
int tfe_bussiness_tableid_get(enum TABLE_TYPE type);
|
||||
11
common/include/tfe_scan.h
Normal file
11
common/include/tfe_scan.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <tfe_stream.h>
|
||||
#define MAX_SCAN_RESULT 16
|
||||
|
||||
int tfe_scan_subscribe_id(const struct tfe_stream *stream, struct Maat_rule_t *result, scan_status_t *scan_mid,
|
||||
int hit_cnt, unsigned int thread_id, void *logger, const char *addr);
|
||||
int tfe_scan_ip_asn(const struct tfe_stream *stream, struct Maat_rule_t *result, scan_status_t *scan_mid,
|
||||
int hit_cnt, unsigned int thread_id, void *logger, const char *addr, char **asn_server, char **asn_client);
|
||||
int tfe_scan_ip_location(const struct tfe_stream *stream, struct Maat_rule_t *result, scan_status_t *scan_mid,
|
||||
int hit_cnt, unsigned int thread_id, void *logger, const char *addr, char **location_server, char **location_client);
|
||||
@@ -158,5 +158,4 @@ struct tfe_stream_addr * tfe_stream_addr_reverse(struct tfe_stream_addr * orin);
|
||||
//Follow function's returned pointer should be passed to free to release the allocated storage when it is no longer needed.
|
||||
char* tfe_string_addr_create_by_fd(int fd, enum tfe_conn_dir dir);
|
||||
char * tfe_stream_addr_to_str(const struct tfe_stream_addr * addr);
|
||||
int tfe_stream_addr_str_split(char* addr_str, const char** sip, const char** sport, const char** dip, const char** dport);
|
||||
int tfe_stream_addr_to_address(const struct tfe_stream_addr *addr, struct ip_address *dest_ip, struct ip_address *source_ip);
|
||||
int tfe_stream_addr_str_split(char* addr_str, const char** sip, const char** sport, const char** dip, const char** dport);
|
||||
@@ -175,5 +175,4 @@ char *tfe_read_file(const char *filename, size_t *filelen);
|
||||
const char * tfe_version();
|
||||
int __wrapper_MESA_htable_set_opt(MESA_htable_handle table, enum MESA_htable_opt opt_type, unsigned value);
|
||||
int __wrapper_MESA_htable_set_opt(MESA_htable_handle table, enum MESA_htable_opt opt_type, void * val, size_t len);
|
||||
int tfe_decode_base64url(u_char *dst, u_char *src);
|
||||
char *tfe_unescape(char *s);
|
||||
int tfe_decode_base64url(u_char *dst, u_char *src);
|
||||
Reference in New Issue
Block a user