Merge pull request #429 from lionsoul2014/update_readme_demo_tests_result
Update readme demo tests result
This commit is contained in:
commit
ebc6253dfe
|
|
@ -82,7 +82,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// 2、调用 search API 查询,IPv4 和 IPv6 都支持.
|
// 2、调用 search API 查询,IPv4 和 IPv6 都支持.
|
||||||
const char *ip_string = "1.2.3.4";
|
const char *ip_string = "1.2.3.4";
|
||||||
// ip_string = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// ip_string = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
|
|
||||||
long cost_time = 0, s_time = xdb_now();
|
long cost_time = 0, s_time = xdb_now();
|
||||||
err = xdb_search_by_string(&searcher, ip_string, ®ion);
|
err = xdb_search_by_string(&searcher, ip_string, ®ion);
|
||||||
|
|
@ -151,7 +151,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// 3、调用 search API 查询,IPv4 和 IPv6 都支持
|
// 3、调用 search API 查询,IPv4 和 IPv6 都支持
|
||||||
const char *ip_string = "1.2.3.4";
|
const char *ip_string = "1.2.3.4";
|
||||||
// ip_string = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// ip_string = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
|
|
||||||
long cost_time = 0, s_time = xdb_now();
|
long cost_time = 0, s_time = xdb_now();
|
||||||
err = xdb_search_by_string(&searcher, ip_string, ®ion);
|
err = xdb_search_by_string(&searcher, ip_string, ®ion);
|
||||||
|
|
@ -220,7 +220,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// 3、调用 search API 查询,IPv4 和 IPv6 都支持
|
// 3、调用 search API 查询,IPv4 和 IPv6 都支持
|
||||||
const char *ip_string = "1.2.3.4";
|
const char *ip_string = "1.2.3.4";
|
||||||
// ip_string = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// ip_string = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
|
|
||||||
long cost_time = 0, s_time = xdb_now();
|
long cost_time = 0, s_time = xdb_now();
|
||||||
err = xdb_search_by_string(&searcher, ip_string, ®ion);
|
err = xdb_search_by_string(&searcher, ip_string, ®ion);
|
||||||
|
|
@ -304,8 +304,10 @@ options:
|
||||||
ip2region xdb searcher test program
|
ip2region xdb searcher test program
|
||||||
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
|
ip2region>> 1.2.3.4
|
||||||
|
{region: Australia|Queensland|Brisbane|0|AU, io_count: 5, took: 39 μs}
|
||||||
ip2region>> 120.229.45.2
|
ip2region>> 120.229.45.2
|
||||||
{region: 中国|广东省|深圳市|移动, io_count: 3, took: 29 μs}
|
{region: 中国|广东省|深圳市|移动|CN, io_count: 3, took: 13 μs}
|
||||||
```
|
```
|
||||||
|
|
||||||
例如:使用默认的 data/ip2region_v6.xdb 进行 IPv6 查询测试:
|
例如:使用默认的 data/ip2region_v6.xdb 进行 IPv6 查询测试:
|
||||||
|
|
@ -317,9 +319,9 @@ type 'quit' to exit
|
||||||
ip2region>> ::
|
ip2region>> ::
|
||||||
{region: , io_count: 1, took: 38 μs}
|
{region: , io_count: 1, took: 38 μs}
|
||||||
ip2region>> 2604:bc80:8001:11a4:ffff:ffff:ffff:ffff
|
ip2region>> 2604:bc80:8001:11a4:ffff:ffff:ffff:ffff
|
||||||
{region: 美国|特拉华州|刘易斯|数据中心, io_count: 14, took: 77 μs}
|
{region: United States|Florida|Miami|velia.net Internetdienste GmbH|US, io_count: 14, took: 76 μs}
|
||||||
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
||||||
{region: 中国|广东省|深圳市|家庭宽带, io_count: 8, took: 46 μs}
|
{region: 中国|广东省|深圳市|电信|CN, io_count: 8, took: 42 μs}
|
||||||
```
|
```
|
||||||
|
|
||||||
输入 ip 即可进行查询,输入 quit 即可退出测试程序。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同的缓存实现的效率。
|
输入 ip 即可进行查询,输入 quit 即可退出测试程序。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同的缓存实现的效率。
|
||||||
|
|
@ -107,7 +107,7 @@ func main() {
|
||||||
|
|
||||||
// 定位信息查询:IPv4 或者 IPv6 的地址都支持
|
// 定位信息查询:IPv4 或者 IPv6 的地址都支持
|
||||||
var ip = "1.2.3.4" // IPv4
|
var ip = "1.2.3.4" // IPv4
|
||||||
// ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff" // IPv6
|
// ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e" // IPv6
|
||||||
var tStart = time.Now()
|
var tStart = time.Now()
|
||||||
region, err := searcher.SearchByStr(ip)
|
region, err := searcher.SearchByStr(ip)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -205,10 +205,11 @@ ip2region search service test program
|
||||||
+-v6 db: /data01/code/c/ip2region/data/ip2region_v6.xdb (vectorIndex)
|
+-v6 db: /data01/code/c/ip2region/data/ip2region_v6.xdb (vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
ip2region>> 1.2.3.4
|
ip2region>> 1.2.3.4
|
||||||
{region: 美国|华盛顿|0|谷歌, took: 69.088µs}
|
{region: Australia|Queensland|Brisbane|0|AU, took: 50.216µs}
|
||||||
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
||||||
{region: 中国|广东省|深圳市|家庭宽带, took: 67.756µs}
|
{region: 中国|广东省|深圳市|电信|CN, took: 100.606µs}
|
||||||
ip2region>>
|
ip2region>> 2604:a840:3::a04d
|
||||||
|
{region: United States|California|San Jose|xTom|US, took: 99.078µs}
|
||||||
```
|
```
|
||||||
输入 v4 或者 v6 的 IP 地址即可进行查询测试,也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的查询效果。
|
输入 v4 或者 v6 的 IP 地址即可进行查询测试,也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的查询效果。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ public class SearcherTest {
|
||||||
// 2、查询,IPv4 或者 IPv6 的地址都支持
|
// 2、查询,IPv4 或者 IPv6 的地址都支持
|
||||||
try {
|
try {
|
||||||
String ip = "1.2.3.4";
|
String ip = "1.2.3.4";
|
||||||
// ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
long sTime = System.nanoTime();
|
long sTime = System.nanoTime();
|
||||||
String region = searcher.search(ip);
|
String region = searcher.search(ip);
|
||||||
long cost = TimeUnit.NANOSECONDS.toMicros((long) (System.nanoTime() - sTime));
|
long cost = TimeUnit.NANOSECONDS.toMicros((long) (System.nanoTime() - sTime));
|
||||||
|
|
@ -173,7 +173,7 @@ public class SearcherTest {
|
||||||
// 3、查询,IPv4 或者 IPv6 地址都支持
|
// 3、查询,IPv4 或者 IPv6 地址都支持
|
||||||
try {
|
try {
|
||||||
String ip = "1.2.3.4";
|
String ip = "1.2.3.4";
|
||||||
// ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
long sTime = System.nanoTime();
|
long sTime = System.nanoTime();
|
||||||
String region = searcher.search(ip);
|
String region = searcher.search(ip);
|
||||||
long cost = TimeUnit.NANOSECONDS.toMicros((long) (System.nanoTime() - sTime));
|
long cost = TimeUnit.NANOSECONDS.toMicros((long) (System.nanoTime() - sTime));
|
||||||
|
|
@ -224,7 +224,7 @@ public class SearcherTest {
|
||||||
// 3、查询,IPv4 和 IPv6 都支持
|
// 3、查询,IPv4 和 IPv6 都支持
|
||||||
try {
|
try {
|
||||||
String ip = "1.2.3.4";
|
String ip = "1.2.3.4";
|
||||||
// ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
long sTime = System.nanoTime();
|
long sTime = System.nanoTime();
|
||||||
String region = searcher.search(ip);
|
String region = searcher.search(ip);
|
||||||
long cost = TimeUnit.NANOSECONDS.toMicros((long) (System.nanoTime() - sTime));
|
long cost = TimeUnit.NANOSECONDS.toMicros((long) (System.nanoTime() - sTime));
|
||||||
|
|
@ -294,10 +294,11 @@ ip2region search service test program
|
||||||
+-v6 xdb: /data01/code/c/ip2region/data/ip2region_v6.xdb (vectorIndex)
|
+-v6 xdb: /data01/code/c/ip2region/data/ip2region_v6.xdb (vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
ip2region>> 1.2.3.4
|
ip2region>> 1.2.3.4
|
||||||
{region: 美国|华盛顿|0|谷歌, took: 159 μs}
|
{region: Australia|Queensland|Brisbane|0|AU, took: 140 μs}
|
||||||
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
||||||
{region: 中国|广东省|深圳市|家庭宽带, took: 346 μs}
|
{region: 中国|广东省|深圳市|电信|CN, took: 391 μs}
|
||||||
ip2region>>
|
ip2region>> 2604:a840:3::a04d
|
||||||
|
{region: United States|California|San Jose|xTom|US, took: 503 μs}
|
||||||
```
|
```
|
||||||
输入 v4 或者 v6 的 IP 地址即可进行查询测试,也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的查询效果。
|
输入 v4 或者 v6 的 IP 地址即可进行查询测试,也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的查询效果。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,9 +119,9 @@ public class Ip2RegionTest {
|
||||||
try {
|
try {
|
||||||
final String region = ip2Region.search(ipBytes);
|
final String region = ip2Region.search(ipBytes);
|
||||||
if (ipBytes.length == 4) {
|
if (ipBytes.length == 4) {
|
||||||
assertEquals("v4 region not equals", region, "中国|广东省|深圳市|电信");
|
assertEquals("v4 region not equals", region, "中国|广东省|深圳市|电信|CN");
|
||||||
} else {
|
} else {
|
||||||
assertEquals("v6 region not equals", region, "中国|广东省|深圳市|家庭宽带");
|
assertEquals("v6 region not equals", region, "中国|广东省|深圳市|电信|CN");
|
||||||
}
|
}
|
||||||
} catch (InetAddressException | IOException | InterruptedException e) {
|
} catch (InetAddressException | IOException | InterruptedException e) {
|
||||||
log.errorf("failed to search(%s): %s", Util.ipToString(ipBytes), e.getMessage());
|
log.errorf("failed to search(%s): %s", Util.ipToString(ipBytes), e.getMessage());
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ try {
|
||||||
|
|
||||||
// 2、查询,IPv4 或者 IPv6 的地址都是同一个接口
|
// 2、查询,IPv4 或者 IPv6 的地址都是同一个接口
|
||||||
let ip = "1.2.3.4";
|
let ip = "1.2.3.4";
|
||||||
// ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
try {
|
try {
|
||||||
let region = searcher.search(ip);
|
let region = searcher.search(ip);
|
||||||
console.log(`search(${ip}): {region: ${region}, ioCount: ${searcher.getIOCount()}}`);
|
console.log(`search(${ip}): {region: ${region}, ioCount: ${searcher.getIOCount()}}`);
|
||||||
|
|
@ -108,7 +108,7 @@ try {
|
||||||
|
|
||||||
// 3、查询,IPv4 或者 IPv6 的地址都是同一个接口
|
// 3、查询,IPv4 或者 IPv6 的地址都是同一个接口
|
||||||
let ip = "1.2.3.4";
|
let ip = "1.2.3.4";
|
||||||
// ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
try {
|
try {
|
||||||
let region = searcher.search(ip);
|
let region = searcher.search(ip);
|
||||||
console.log(`search(${ip}): {region: ${region}, ioCount: ${searcher.getIOCount()}}`);
|
console.log(`search(${ip}): {region: ${region}, ioCount: ${searcher.getIOCount()}}`);
|
||||||
|
|
@ -148,7 +148,7 @@ try {
|
||||||
|
|
||||||
// 3、查询,IPv4 或者 IPv6 的地址都是同一个接口
|
// 3、查询,IPv4 或者 IPv6 的地址都是同一个接口
|
||||||
let ip = "1.2.3.4";
|
let ip = "1.2.3.4";
|
||||||
// ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
try {
|
try {
|
||||||
let region = searcher.search(ip);
|
let region = searcher.search(ip);
|
||||||
console.log(`search(${ip}): {region: ${region}`);
|
console.log(`search(${ip}): {region: ${region}`);
|
||||||
|
|
@ -186,7 +186,9 @@ ip2region xdb searcher test program
|
||||||
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
ip2region>> 1.2.3.4
|
ip2region>> 1.2.3.4
|
||||||
{region: 美国|华盛顿|0|谷歌, ioCount: 7, took: 0.430357 μs}
|
{region: Australia|Queensland|Brisbane|0|AU, ioCount: 5, took: 657.035 μs}
|
||||||
|
ip2region>> 113.118.113.77
|
||||||
|
{region: 中国|广东省|深圳市|电信|CN, ioCount: 2, took: 169.927 μs}
|
||||||
```
|
```
|
||||||
|
|
||||||
例如:使用默认的 data/ip2region_v6.xdb 文件进行 IPv6 的查询测试:
|
例如:使用默认的 data/ip2region_v6.xdb 文件进行 IPv6 的查询测试:
|
||||||
|
|
@ -196,7 +198,9 @@ ip2region xdb searcher test program
|
||||||
source xdb: ../../data/ip2region_v6.xdb (IPv6, vectorIndex)
|
source xdb: ../../data/ip2region_v6.xdb (IPv6, vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
||||||
{region: 中国|广东省|深圳市|家庭宽带, ioCount: 14, took: 4.727663 μs}
|
{region: 中国|广东省|深圳市|电信|CN, ioCount: 8, took: 98.953 μs}
|
||||||
|
ip2region>> 2604:a840:3::a04d
|
||||||
|
{region: United States|California|San Jose|xTom|US, ioCount: 13, took: 287.703 μs}
|
||||||
```
|
```
|
||||||
|
|
||||||
输入 ip 即可进行查询测试,也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的查询效果。
|
输入 ip 即可进行查询测试,也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的查询效果。
|
||||||
|
|
@ -177,7 +177,9 @@ ip2region xdb searcher test program
|
||||||
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
ip2region>> 1.2.3.4
|
ip2region>> 1.2.3.4
|
||||||
{region: 美国|华盛顿|0|谷歌, io_count: 7, took: 0μs}
|
{region: Australia|Queensland|Brisbane|0|AU, io_count: 5, took: 0μs}
|
||||||
|
ip2region>> 113.118.113.77
|
||||||
|
{region: 中国|广东省|深圳市|电信|CN, io_count: 2, took: 0μs}
|
||||||
```
|
```
|
||||||
|
|
||||||
例如:使用默认的 data/ip2region_v6.xdb 文件进行 IPv6 的查询测试:
|
例如:使用默认的 data/ip2region_v6.xdb 文件进行 IPv6 的查询测试:
|
||||||
|
|
@ -187,7 +189,9 @@ ip2region xdb searcher test program
|
||||||
source xdb: ../../data/ip2region_v6.xdb (IPv6, vectorIndex)
|
source xdb: ../../data/ip2region_v6.xdb (IPv6, vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
||||||
{region: 中国|广东省|深圳市|家庭宽带, io_count: 8, took: 0μs}
|
{region: 中国|广东省|深圳市|电信|CN, io_count: 8, took: 0μs}
|
||||||
|
ip2region>> 2604:a840:3::a04d
|
||||||
|
{region: United States|California|San Jose|xTom|US, io_count: 13, took: 0μs}
|
||||||
```
|
```
|
||||||
|
|
||||||
输入 ip 即可进行查询测试。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的效率。
|
输入 ip 即可进行查询测试。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的效率。
|
||||||
|
|
@ -91,7 +91,7 @@ end
|
||||||
|
|
||||||
-- 2、调用查询 API 进行查询,IPv4 和 IPv6 都支持
|
-- 2、调用查询 API 进行查询,IPv4 和 IPv6 都支持
|
||||||
local ip_str = "1.2.3.4"
|
local ip_str = "1.2.3.4"
|
||||||
-- ip_str = "2001:4:112:ffff:ffff:ffff:ffff:ffff" // IPv6
|
-- ip_str = "240e:3b7:3272:d8d0:db09:c067:8d59:539e" // IPv6
|
||||||
local s_time = xdb.now()
|
local s_time = xdb.now()
|
||||||
region, err = searcher:search(ip_str)
|
region, err = searcher:search(ip_str)
|
||||||
local c_time = xdb.now() - s_time
|
local c_time = xdb.now() - s_time
|
||||||
|
|
@ -135,7 +135,7 @@ end
|
||||||
|
|
||||||
-- 3、调用查询 API ,IPv4 和 IPv6 都支持
|
-- 3、调用查询 API ,IPv4 和 IPv6 都支持
|
||||||
local ip_str = "1.2.3.4"
|
local ip_str = "1.2.3.4"
|
||||||
-- ip_str = "2001:4:112:ffff:ffff:ffff:ffff:ffff" // IPv6
|
-- ip_str = "240e:3b7:3272:d8d0:db09:c067:8d59:539e" // IPv6
|
||||||
local s_time = xdb.now()
|
local s_time = xdb.now()
|
||||||
region, err = searcher:search(ip_str)
|
region, err = searcher:search(ip_str)
|
||||||
local c_time = xdb.now() = s_time
|
local c_time = xdb.now() = s_time
|
||||||
|
|
@ -179,7 +179,7 @@ end
|
||||||
|
|
||||||
-- 3、调用查询 API ,IPv4 和 IPv6 都支持
|
-- 3、调用查询 API ,IPv4 和 IPv6 都支持
|
||||||
local ip_str = "1.2.3.4"
|
local ip_str = "1.2.3.4"
|
||||||
-- ip_str = "2001:4:112:ffff:ffff:ffff:ffff:ffff" // IPv6
|
-- ip_str = "240e:3b7:3272:d8d0:db09:c067:8d59:539e" // IPv6
|
||||||
local s_time = xdb.now()
|
local s_time = xdb.now()
|
||||||
region, err = searcher:search(ip_str)
|
region, err = searcher:search(ip_str)
|
||||||
local c_time = xdb.now() - s_time
|
local c_time = xdb.now() - s_time
|
||||||
|
|
@ -219,8 +219,10 @@ options:
|
||||||
ip2region xdb searcher test program
|
ip2region xdb searcher test program
|
||||||
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
|
ip2region>> 1.2.3.4
|
||||||
|
{region: Australia|Queensland|Brisbane|0|AU, io_count: 5, took: 17μs}
|
||||||
ip2region>> 120.229.45.2
|
ip2region>> 120.229.45.2
|
||||||
{region: 中国|广东省|深圳市|移动, io_count: 3, took: 34μs}
|
{region: 中国|广东省|深圳市|移动|CN, io_count: 3, took: 40μs}
|
||||||
```
|
```
|
||||||
|
|
||||||
例如:使用默认的 data/ip2region_v6.xdb 进行 IPv6 查询测试:
|
例如:使用默认的 data/ip2region_v6.xdb 进行 IPv6 查询测试:
|
||||||
|
|
@ -232,7 +234,9 @@ type 'quit' to exit
|
||||||
ip2region>> ::
|
ip2region>> ::
|
||||||
{region: , io_count: 1, took: 48μs}
|
{region: , io_count: 1, took: 48μs}
|
||||||
ip2region>> 240e:3b7:3276:33b0:958f:f34c:d04f:f6a
|
ip2region>> 240e:3b7:3276:33b0:958f:f34c:d04f:f6a
|
||||||
{region: 中国|广东省|深圳市|家庭宽带, io_count: 8, took: 51μs}
|
{region: 中国|广东省|深圳市|电信|CN, io_count: 8, took: 52μs}
|
||||||
|
ip2region>> 2604:a840:3::a04d
|
||||||
|
{region: United States|California|San Jose|xTom|US, io_count: 13, took: 35μs}
|
||||||
```
|
```
|
||||||
|
|
||||||
输入 ip 即可进行查询测试。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的效率。
|
输入 ip 即可进行查询测试。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的效率。
|
||||||
|
|
@ -68,7 +68,7 @@ try {
|
||||||
// 2, 查询,IPv4 或者 IPv6 的地址都支持
|
// 2, 查询,IPv4 或者 IPv6 的地址都支持
|
||||||
try {
|
try {
|
||||||
$ip = '1.2.3.4';
|
$ip = '1.2.3.4';
|
||||||
// $ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// $ip = ""240e:3b7:3272:d8d0:db09:c067:8d59:539e; // IPv6
|
||||||
$sTime = Util::now();
|
$sTime = Util::now();
|
||||||
$region = $searcher->search($ip);
|
$region = $searcher->search($ip);
|
||||||
$costMs = Util::now() - $sTime;
|
$costMs = Util::now() - $sTime;
|
||||||
|
|
@ -111,7 +111,7 @@ try {
|
||||||
// 3、查询,IPv4 或者 IPv6 都支持
|
// 3、查询,IPv4 或者 IPv6 都支持
|
||||||
try {
|
try {
|
||||||
$ip = '1.2.3.4';
|
$ip = '1.2.3.4';
|
||||||
// $ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// $ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
$sTime = Util::now();
|
$sTime = Util::now();
|
||||||
$region = $searcher->search($ip);
|
$region = $searcher->search($ip);
|
||||||
$costMs = Util::now() - $sTime;
|
$costMs = Util::now() - $sTime;
|
||||||
|
|
@ -153,7 +153,7 @@ try {
|
||||||
// 3、查询,IPv4 或者 IPv6 都支持
|
// 3、查询,IPv4 或者 IPv6 都支持
|
||||||
try {
|
try {
|
||||||
$ip = '1.2.3.4';
|
$ip = '1.2.3.4';
|
||||||
// $ip = "2001:4:112:ffff:ffff:ffff:ffff:ffff"; // IPv6
|
// $ip = "240e:3b7:3272:d8d0:db09:c067:8d59:539e"; // IPv6
|
||||||
$sTime = Util::now();
|
$sTime = Util::now();
|
||||||
$region = $searcher->search($ip);
|
$region = $searcher->search($ip);
|
||||||
$costMs = Util::now() - $sTime;
|
$costMs = Util::now() - $sTime;
|
||||||
|
|
@ -186,8 +186,10 @@ options:
|
||||||
ip2region xdb searcher test program
|
ip2region xdb searcher test program
|
||||||
source xdb file: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
source xdb file: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
|
ip2region>> 1.2.3.4
|
||||||
|
{region: Australia|Queensland|Brisbane|0|AU, ioCount: 5, took: 0.12695 ms}
|
||||||
ip2region>> 120.229.45.2
|
ip2region>> 120.229.45.2
|
||||||
{region: 中国|广东省|深圳市|移动, ioCount: 3, took: 0.02783 ms}
|
{region: 中国|广东省|深圳市|移动|CN, ioCount: 3, took: 0.07397 ms}
|
||||||
```
|
```
|
||||||
|
|
||||||
例如:使用默认的 data/ip2region_v6.xdb 进行 IPv6 的查询测试:
|
例如:使用默认的 data/ip2region_v6.xdb 进行 IPv6 的查询测试:
|
||||||
|
|
@ -199,7 +201,9 @@ type 'quit' to exit
|
||||||
ip2region>> ::
|
ip2region>> ::
|
||||||
{region: , ioCount: 1, took: 0.08887 ms}
|
{region: , ioCount: 1, took: 0.08887 ms}
|
||||||
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
||||||
{region: 中国|广东省|深圳市|家庭宽带, ioCount: 8, took: 0.09595 ms}
|
{region: 中国|广东省|深圳市|电信|CN, ioCount: 8, took: 0.10303 ms}
|
||||||
|
ip2region>> 2604:a840:3::a04d
|
||||||
|
{region: United States|California|San Jose|xTom|US, ioCount: 13, took: 0.04614 ms}
|
||||||
```
|
```
|
||||||
|
|
||||||
输入 ip 即可进行查询测试。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的效率。
|
输入 ip 即可进行查询测试。也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的效率。
|
||||||
|
|
@ -177,7 +177,9 @@ ip2region xdb searcher test program
|
||||||
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
source xdb: ../../data/ip2region_v4.xdb (IPv4, vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
ip2region>> 1.2.3.4
|
ip2region>> 1.2.3.4
|
||||||
{region: 美国|华盛顿|0|谷歌, ioCount: 7, took: 185 μs}
|
{region: Australia|Queensland|Brisbane|0|AU, ioCount: 5, took: 188 μs}
|
||||||
|
ip2region>> 113.118.113.77
|
||||||
|
{region: 中国|广东省|深圳市|电信|CN, ioCount: 2, took: 143 μs}
|
||||||
```
|
```
|
||||||
|
|
||||||
例如:使用默认的 data/ip2region_v6.xdb 文件进行 IPv6 的查询测试:
|
例如:使用默认的 data/ip2region_v6.xdb 文件进行 IPv6 的查询测试:
|
||||||
|
|
@ -186,8 +188,12 @@ ip2region>> 1.2.3.4
|
||||||
ip2region xdb searcher test program
|
ip2region xdb searcher test program
|
||||||
source xdb: ../../data/ip2region_v6.xdb (IPv6, vectorIndex)
|
source xdb: ../../data/ip2region_v6.xdb (IPv6, vectorIndex)
|
||||||
type 'quit' to exit
|
type 'quit' to exit
|
||||||
|
ip2region>> ::
|
||||||
|
{region: , ioCount: 1, took: 166 μs}
|
||||||
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
ip2region>> 240e:3b7:3272:d8d0:db09:c067:8d59:539e
|
||||||
{region: 中国|广东省|深圳市|家庭宽带, ioCount: 8, took: 211 μs}
|
{region: 中国|广东省|深圳市|电信|CN, ioCount: 8, took: 197 μs}
|
||||||
|
ip2region>> 2604:a840:3::a04d
|
||||||
|
{region: United States|California|San Jose|xTom|US, ioCount: 13, took: 240 μs}
|
||||||
```
|
```
|
||||||
|
|
||||||
输入 ip 即可进行查询测试,也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的查询效果。
|
输入 ip 即可进行查询测试,也可以分别设置 `cache-policy` 为 file/vectorIndex/content 来测试三种不同缓存实现的查询效果。
|
||||||
Loading…
Reference in New Issue