仅支持4级及以上IP归属地
This commit is contained in:
@@ -1153,7 +1153,7 @@
|
||||
"table_content": {
|
||||
"format": "uncase plain",
|
||||
"match_method": "complete",
|
||||
"keywords": "country_full_test..city_full_test.",
|
||||
"keywords": "country_full_test..city_full_test..",
|
||||
"expr_type": "none"
|
||||
}
|
||||
}
|
||||
@@ -1184,7 +1184,7 @@
|
||||
"table_content": {
|
||||
"format": "uncase plain",
|
||||
"match_method": "complete",
|
||||
"keywords": "country_full_test..city_full_test.",
|
||||
"keywords": "country_full_test..city_full_test..",
|
||||
"expr_type": "none"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,6 +707,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457)
|
||||
srt_attribute->client_location->province_full=(char *)"beijing";
|
||||
srt_attribute->client_location->city_full=(char *)"west";
|
||||
srt_attribute->client_location->subdivision_addr=(char *)"yuming road";
|
||||
srt_attribute->client_location->full_location=(char *)"china.beijing.west.yuming road.";
|
||||
|
||||
srt_attribute->server_location=(struct location_info *)dictator_malloc(0, sizeof(struct location_info));
|
||||
srt_attribute->server_location->ref_cnt=1;
|
||||
@@ -714,6 +715,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457)
|
||||
srt_attribute->server_location->province_full=(char *)"shanghai";
|
||||
srt_attribute->server_location->city_full=(char *)"east";
|
||||
srt_attribute->server_location->subdivision_addr=(char *)"zhongshan road";
|
||||
srt_attribute->server_location->full_location=(char *)"china.shanghai.east.zhongshan road.";
|
||||
|
||||
srt_attribute->client_subscribe_id=(struct subscribe_id_info *)dictator_malloc(0, sizeof(struct subscribe_id_info));
|
||||
srt_attribute->client_subscribe_id->ref_cnt=1;
|
||||
@@ -807,6 +809,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457)
|
||||
EXPECT_STREQ("beijing", srt_attribute_out->client_location->province_full);
|
||||
EXPECT_STREQ("west", srt_attribute_out->client_location->city_full);
|
||||
EXPECT_STREQ("yuming road", srt_attribute_out->client_location->subdivision_addr);
|
||||
EXPECT_STREQ("china.beijing.west.yuming road.", srt_attribute_out->client_location->full_location);
|
||||
|
||||
const struct location_info *c_location=srt_attribute_get_client_ip_location((const struct session_runtime_attribute *)srt_attribute_out);
|
||||
EXPECT_NE(nullptr, c_location);
|
||||
@@ -815,6 +818,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457)
|
||||
EXPECT_STREQ("beijing", c_location->province_full);
|
||||
EXPECT_STREQ("west", c_location->city_full);
|
||||
EXPECT_STREQ("yuming road", c_location->subdivision_addr);
|
||||
EXPECT_STREQ("china.beijing.west.yuming road.", c_location->full_location);
|
||||
|
||||
EXPECT_NE(nullptr, srt_attribute_out->server_location);
|
||||
EXPECT_EQ(1, srt_attribute_out->server_location->ref_cnt);
|
||||
@@ -822,6 +826,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457)
|
||||
EXPECT_STREQ("shanghai", srt_attribute_out->server_location->province_full);
|
||||
EXPECT_STREQ("east", srt_attribute_out->server_location->city_full);
|
||||
EXPECT_STREQ("zhongshan road", srt_attribute_out->server_location->subdivision_addr);
|
||||
EXPECT_STREQ("china.shanghai.east.zhongshan road.", srt_attribute_out->server_location->full_location);
|
||||
|
||||
const struct location_info *s_location=srt_attribute_get_server_ip_location((const struct session_runtime_attribute *)srt_attribute_out);
|
||||
EXPECT_NE(nullptr, s_location);
|
||||
@@ -830,6 +835,7 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeTSG15457)
|
||||
EXPECT_STREQ("shanghai", s_location->province_full);
|
||||
EXPECT_STREQ("east", s_location->city_full);
|
||||
EXPECT_STREQ("zhongshan road", s_location->subdivision_addr);
|
||||
EXPECT_STREQ("china.shanghai.east.zhongshan road.", s_location->full_location);
|
||||
|
||||
EXPECT_NE(nullptr, srt_attribute_out->client_subscribe_id);
|
||||
EXPECT_EQ(1, srt_attribute_out->client_subscribe_id->ref_cnt);
|
||||
|
||||
@@ -206,7 +206,8 @@ TEST(TM, ExDataLocationBuiltIn)
|
||||
EXPECT_STREQ("Other", location->city_full);
|
||||
EXPECT_STREQ("Hong Kong", location->country_full);
|
||||
EXPECT_STREQ("Other", location->province_full);
|
||||
EXPECT_STREQ(NULL, location->subdivision_addr);
|
||||
EXPECT_STREQ("Road1", location->subdivision_addr);
|
||||
EXPECT_STREQ("Hong Kong.Other.Other.Road1.", location->full_location);
|
||||
EXPECT_EQ(2, location->ref_cnt);
|
||||
|
||||
temp_addr.ipv4 = inet_addr("192.168.50.2");
|
||||
@@ -215,7 +216,8 @@ TEST(TM, ExDataLocationBuiltIn)
|
||||
EXPECT_STREQ("Xin Xi Gang", location->city_full);
|
||||
EXPECT_STREQ("China", location->country_full);
|
||||
EXPECT_STREQ("Beijing", location->province_full);
|
||||
EXPECT_STREQ(NULL, location->subdivision_addr); // location_field_num == 18; not 19
|
||||
EXPECT_STREQ("Road1", location->subdivision_addr);
|
||||
EXPECT_STREQ("China.Beijing.Xin Xi Gang.Road1.", location->full_location);
|
||||
EXPECT_EQ(2, location->ref_cnt);
|
||||
|
||||
location = NULL;
|
||||
@@ -240,7 +242,8 @@ TEST(TM, ExDataLocationUserDefine)
|
||||
EXPECT_STREQ("Hua Yan Bei Li", location->city_full);
|
||||
EXPECT_STREQ("China", location->country_full);
|
||||
EXPECT_STREQ("Beijing", location->province_full);
|
||||
EXPECT_STREQ(NULL, location->subdivision_addr); // location_field_num == 18; not 19
|
||||
EXPECT_STREQ("Road1", location->subdivision_addr);
|
||||
EXPECT_STREQ("China.Beijing.Hua Yan Bei Li.Road1.", location->full_location);
|
||||
EXPECT_EQ(2, location->ref_cnt);
|
||||
|
||||
location = NULL;
|
||||
|
||||
@@ -757,7 +757,7 @@ TEST(TSG_Table, TSG_SECURITY_SOURCE_LOCATION)
|
||||
struct location_info location = {0};
|
||||
location.country_full = (char *)"country_full_test";
|
||||
location.city_full = (char *)"city_full_test";
|
||||
location.full_location=(char *)"country_full_test..city_full_test.";
|
||||
location.full_location=(char *)"country_full_test..city_full_test..";
|
||||
location.full_location_len=strlen(location.full_location);
|
||||
struct maat_state *mid = maat_state_new(g_tsg_maat_feather, a_stream.threadnum);
|
||||
struct maat_rule results[MAX_RESULT_NUM] = {0};
|
||||
@@ -774,7 +774,7 @@ TEST(TSG_Table, TSG_SECURITY_DESTINATION_LOCATION)
|
||||
struct location_info location = {0};
|
||||
location.country_full = (char *)"country_full_test";
|
||||
location.city_full = (char *)"city_full_test";
|
||||
location.full_location=(char *)"country_full_test..city_full_test.";
|
||||
location.full_location=(char *)"country_full_test..city_full_test..";
|
||||
location.full_location_len=strlen(location.full_location);
|
||||
struct maat_state *mid = maat_state_new(g_tsg_maat_feather, a_stream.threadnum);
|
||||
struct maat_rule results[MAX_RESULT_NUM] = {0};
|
||||
|
||||
Reference in New Issue
Block a user