new: add ipwho.is
This commit is contained in:
@@ -1 +1 @@
|
|||||||
core.version=0.16.1
|
core.version=0.16.4
|
||||||
@@ -127,6 +127,7 @@ class ProxyRepositoryImpl
|
|||||||
final Map<String, IpInfo Function(Map<String, dynamic> response)>
|
final Map<String, IpInfo Function(Map<String, dynamic> response)>
|
||||||
_ipInfoSources = {
|
_ipInfoSources = {
|
||||||
// "https://geolocation-db.com/json/": IpInfo.fromGeolocationDbComJson, //bug response is not json
|
// "https://geolocation-db.com/json/": IpInfo.fromGeolocationDbComJson, //bug response is not json
|
||||||
|
"https://ipwho.is/": IpInfo.fromIpwhoIsJson,
|
||||||
"https://api.ip.sb/geoip/": IpInfo.fromIpSbJson,
|
"https://api.ip.sb/geoip/": IpInfo.fromIpSbJson,
|
||||||
"https://ipapi.co/json/": IpInfo.fromIpApiCoJson,
|
"https://ipapi.co/json/": IpInfo.fromIpApiCoJson,
|
||||||
"https://ipinfo.io/json/": IpInfo.fromIpInfoIoJson,
|
"https://ipinfo.io/json/": IpInfo.fromIpInfoIoJson,
|
||||||
|
|||||||
@@ -92,6 +92,30 @@ class IpInfo with IpInfoMappable {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static IpInfo fromIpwhoIsJson(Map<String, dynamic> json) {
|
||||||
|
return switch (json) {
|
||||||
|
{
|
||||||
|
"ip": final String ip,
|
||||||
|
"country_code": final String countryCode,
|
||||||
|
// "region": final String region,
|
||||||
|
// "city": final String city,
|
||||||
|
// "timezone": final String timezone,
|
||||||
|
// "asn": final int asn,
|
||||||
|
"connection": final Map<String, dynamic> connection,
|
||||||
|
} =>
|
||||||
|
IpInfo(
|
||||||
|
ip: ip,
|
||||||
|
countryCode: countryCode,
|
||||||
|
// region: region,
|
||||||
|
// city: city,
|
||||||
|
// timezone: timezone,
|
||||||
|
asn: '$connection["asn"]',
|
||||||
|
org: '$connection["org"]',
|
||||||
|
),
|
||||||
|
_ => throw const FormatException("invalid json"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static IpInfo fromGeolocationDbComJson(Map<String, dynamic> json) {
|
static IpInfo fromGeolocationDbComJson(Map<String, dynamic> json) {
|
||||||
return switch (json) {
|
return switch (json) {
|
||||||
{
|
{
|
||||||
|
|||||||
2
libcore
2
libcore
Submodule libcore updated: 48297a74ae...4dad3022f3
Reference in New Issue
Block a user