mirror of
https://github.com/vernette/ipregion.git
synced 2026-07-10 00:08:41 +00:00
Add detector404.ru GeoIP service
- Add Detector404 to PRIMARY_SERVICES - Add to PRIMARY_SERVICES_ORDER - Add jq filter in process_response() for .data.country.ccode - Add lookup_detector404() function API endpoint: https://geoip.detector404.ru/api/v1/ip/{ip} Free access, no authentication required 💘 Generated with Crush Assisted-by: GLM-4.7 via Crush <crush@charm.land>
This commit is contained in:
parent
f5c0474aac
commit
d646640f35
1 changed files with 9 additions and 0 deletions
|
|
@ -84,6 +84,7 @@ declare -A PRIMARY_SERVICES=(
|
|||
[IPQUERY_IO]="ipquery.io|api.ipquery.io|/{ip}"
|
||||
[IPWHO_IS]="ipwho.is|ipwho.is|/{ip}"
|
||||
[IPAPI_COM]="ip-api.com|demo.ip-api.com|/json/{ip}?fields=countryCode"
|
||||
[DETECTOR404]="Detector404|geoip.detector404.ru|/api/v1/ip/{ip}"
|
||||
)
|
||||
|
||||
PRIMARY_SERVICES_ORDER=(
|
||||
|
|
@ -102,6 +103,7 @@ PRIMARY_SERVICES_ORDER=(
|
|||
"IPQUERY_IO"
|
||||
"IPWHO_IS"
|
||||
"IPAPI_COM"
|
||||
"DETECTOR404"
|
||||
)
|
||||
|
||||
declare -A PRIMARY_SERVICES_CUSTOM_HANDLERS=(
|
||||
|
|
@ -1726,6 +1728,9 @@ process_response() {
|
|||
IPAPI_COM)
|
||||
jq_filter='.countryCode'
|
||||
;;
|
||||
DETECTOR404)
|
||||
jq_filter='.data.country.ccode'
|
||||
;;
|
||||
*)
|
||||
echo "$response"
|
||||
;;
|
||||
|
|
@ -2249,6 +2254,10 @@ lookup_ifconfig_co() {
|
|||
process_service "IFCONFIG_CO"
|
||||
}
|
||||
|
||||
lookup_detector404() {
|
||||
process_service "DETECTOR404"
|
||||
}
|
||||
|
||||
lookup_iplocation_com() {
|
||||
local ip_version="$1"
|
||||
local response ip
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue