mirror of
https://dev.azure.com/tstanciu94/PhantomMind/_git/Bitip
synced 2025-10-13 01:52:19 +03:00
feat: enhance GeoIP service to include ASN information in detailed responses
This commit is contained in:
parent
50320f8591
commit
27b3073907
@ -111,9 +111,12 @@ class GeoIPService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response: City = this.cityReader!.city(ip);
|
const response: City = this.cityReader!.city(ip);
|
||||||
|
const asnResponse: Asn = this.asnReader!.asn(ip);
|
||||||
|
|
||||||
const result: DetailedGeoIPResponse = {
|
const result: DetailedGeoIPResponse = {
|
||||||
ip,
|
ip,
|
||||||
location: response as GeoIPLocation,
|
location: response as GeoIPLocation,
|
||||||
|
asn: asnResponse,
|
||||||
};
|
};
|
||||||
|
|
||||||
this.cache.set(cacheKey, result);
|
this.cache.set(cacheKey, result);
|
||||||
|
@ -37,6 +37,13 @@ export interface GeoIPLocation {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AsnInfo {
|
||||||
|
autonomousSystemNumber?: number;
|
||||||
|
autonomousSystemOrganization?: string;
|
||||||
|
ipAddress?: string;
|
||||||
|
network?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface SimplifiedGeoIPResponse {
|
export interface SimplifiedGeoIPResponse {
|
||||||
ip: string;
|
ip: string;
|
||||||
country: string;
|
country: string;
|
||||||
@ -58,6 +65,7 @@ export interface SimplifiedGeoIPResponse {
|
|||||||
export interface DetailedGeoIPResponse {
|
export interface DetailedGeoIPResponse {
|
||||||
ip: string;
|
ip: string;
|
||||||
location: GeoIPLocation;
|
location: GeoIPLocation;
|
||||||
|
asn: AsnInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BatchGeoIPRequest {
|
export interface BatchGeoIPRequest {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user