IPLookupService Controller Service
描述
一种查找服务,提供多种类型的 IP 地址丰富信息。 通过提供 MaxMind 数据库文件并指定应为 IP 地址或主机名提供哪些类型的丰富来配置该服务。 每种类型的丰富都是单独的查找,因此将服务配置为提供所有可用的丰富数据可能比仅返回一部分可用的丰富数据慢。 为了使用此服务,必须使用“ip”键和有效 IP 地址或主机名的值来执行查找。 查看此组件的使用情况,并选择查看其他详细信息以获取更多信息,例如与返回的信息相关的架构。
标签
属性
| 名称 | 默认值 | 可选值 | 描述 |
|---|---|---|---|
| MaxMind Database File | | Maxmind IP 丰富数据库文件的路径 支持表达式语言:是(仅使用环境/系统变量求值) | |
| Lookup Geo Enrichment | true |
| 是否返回IP地址对应的地理信息,如城市等信息 |
| Lookup ISP | false |
| 指定是否返回IP地址对应的信息服务提供商的信息 |
| Lookup Domain Name | false |
| 指定是否应返回与 IP 地址对应的域名信息。如果为 true,查找结果将包含二级域名信息,如 foo.com,但不包含 bar.foo.com。 |
| Lookup Connection Type | false |
| 指定是否应返回与 IP 地址对应的连接类型信息。如果为 true,查找结果将包含 'connectionType' 字段,该字段(如果已填充)将包含 'Dialup'、'Cable/DSL'、'Corporate' 或 'Cellular' 的值。 |
| Lookup Anonymous IP Information | false |
| 指定是否应返回有关 IP 地址是否属于匿名网络的信息。 |
状态管理
该组件不存储状态。
受限 (Restricted)
该组件不受限。
提供的 Service API
LookupServiceRecordLookupService
详细说明
IPLookupService
IPLookupService 由 MaxMind 数据库驱动,可以返回关于给定 IP 地址的多种
富化(enrichment)信息。以下是该服务返回的记录的 schema(Avro Schema
格式)。该 schema 是一条包含若干字段的单条记录:geo、isp、
domainName、connectionType 和 anonymousIp。这些字段都可为
null,只有当被查询的 IP 地址在 MaxMind 数据库中有相关信息,且
Controller Service 配置为返回该信息时,才会被填充。由于每个字段都需要
在数据库中单独查询,建议只获取有价值的字段。
{
"name": "enrichmentRecord",
"namespace": "lynxus",
"type": "record",
"fields": [
{
"name": "geo",
"type": [
"null",
{
"name": "cityGeo",
"type": "record",
"fields": [
{
"name": "city",
"type": [
"null",
"string"
]
},
{
"name": "accuracy",
"type": [
"null",
"int"
],
"doc": "以公里为单位的半径,表示围绕给定位置、该 IP 地址被认为所在的范围"
},
{
"name": "metroCode",
"type": [
"null",
"int"
]
},
{
"name": "timeZone",
"type": [
"null",
"string"
]
},
{
"name": "latitude",
"type": [
"null",
"double"
]
},
{
"name": "longitude",
"type": [
"null",
"double"
]
},
{
"name": "country",
"type": [
"null",
{
"type": "record",
"name": "country",
"fields": [
{
"name": "name",
"type": "string"
},
{
"name": "isoCode",
"type": "string"
}
]
}
]
},
{
"name": "subdivisions",
"type": {
"type": "array",
"items": {
"type": "record",
"name": "subdivision",
"fields": [
{
"name": "name",
"type": "string"
},
{
"name": "isoCode",
"type": "string"
}
]
}
}
},
{
"name": "continent",
"type": [
"null",
"string"
]
},
{
"name": "postalCode",
"type": [
"null",
"string"
]
}
]
}
]
},
{
"name": "isp",
"type": [
"null",
{
"name": "ispEnrich",
"type": "record",
"fields": [
{
"name": "name",
"type": [
"null",
"string"
]
},
{
"name": "organization",
"type": [
"null",
"string"
]
},
{
"name": "asn",
"type": [
"null",
"int"
]
},
{
"name": "asnOrganization",
"type": [
"null",
"string"
]
}
]
}
]
},
{
"name": "domainName",
"type": [
"null",
"string"
]
},
{
"name": "connectionType",
"type": [
"null",
"string"
],
"doc": "'Dialup'、'Cable/DSL'、'Corporate'、'Cellular' 之一"
},
{
"name": "anonymousIp",
"type": [
"null",
{
"name": "anonymousIpType",
"type": "record",
"fields": [
{
"name": "anonymous",
"type": "boolean"
},
{
"name": "anonymousVpn",
"type": "boolean"
},
{
"name": "hostingProvider",
"type": "boolean"
},
{
"name": "publicProxy",
"type": "boolean"
},
{
"name": "torExitNode",
"type": "boolean"
}
]
}
]
}
]
}
虽然这个 schema 相当复杂,但它只是一条包含 5 个字段的记录。这使得更新现有 schema 以容纳该记录非常容易:只需在现有 schema 中添加一个新字段,并把上面的 schema 粘贴为该字段的类型。
例如,假设我们有一个如下这样简单的现有 schema:
{
"name": "ipRecord",
"namespace": "lynxus",
"type": "record",
"fields": [
{
"name": "ip",
"type": "string"
}
]
}
再假设我们想给上面的 schema 添加一个名为 enrichment 的新字段,并希望该
新字段可为 null。可以这样做:把上面的富化 schema 复制粘贴进来:
{
"name": "ipRecord",
"namespace": "lynxus",
"type": "record",
"fields": [
{
"name": "ip",
"type": "string"
},
{
"name": "enrichment",
"type": [
"null",
<在此粘贴富化 Schema>
]
}
]
}