new: add warp fake packet delay, add warp detour, add new ipinfo api
This commit is contained in:
@@ -121,6 +121,8 @@ class ProxyRepositoryImpl
|
||||
|
||||
final Map<String, IpInfo Function(Map<String, dynamic> response)>
|
||||
_ipInfoSources = {
|
||||
// "https://geolocation-db.com/json/": IpInfo.fromGeolocationDbComJson,
|
||||
"https://api.ip.sb/geoip/": IpInfo.fromIpSbJson,
|
||||
"https://ipapi.co/json/": IpInfo.fromIpApiCoJson,
|
||||
"https://ipinfo.io/json/": IpInfo.fromIpInfoIoJson,
|
||||
};
|
||||
|
||||
@@ -67,4 +67,46 @@ class IpInfo with IpInfoMappable {
|
||||
_ => throw const FormatException("invalid json"),
|
||||
};
|
||||
}
|
||||
|
||||
static IpInfo fromIpSbJson(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,
|
||||
"asn_organization": final String org,
|
||||
} =>
|
||||
IpInfo(
|
||||
ip: ip,
|
||||
countryCode: countryCode,
|
||||
region: region,
|
||||
city: city,
|
||||
timezone: timezone,
|
||||
asn: '$asn',
|
||||
org: org,
|
||||
),
|
||||
_ => throw const FormatException("invalid json"),
|
||||
};
|
||||
}
|
||||
|
||||
static IpInfo fromGeolocationDbComJson(Map<String, dynamic> json) {
|
||||
return switch (json) {
|
||||
{
|
||||
"ip": final String ip,
|
||||
"country_code": final String countryCode,
|
||||
"state": final String region,
|
||||
"city": final String city
|
||||
} =>
|
||||
IpInfo(
|
||||
ip: ip,
|
||||
countryCode: countryCode,
|
||||
region: region,
|
||||
city: city,
|
||||
),
|
||||
_ => throw const FormatException("invalid json"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user