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 {
|
||||
const response: City = this.cityReader!.city(ip);
|
||||
const asnResponse: Asn = this.asnReader!.asn(ip);
|
||||
|
||||
const result: DetailedGeoIPResponse = {
|
||||
ip,
|
||||
location: response as GeoIPLocation,
|
||||
asn: asnResponse,
|
||||
};
|
||||
|
||||
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 {
|
||||
ip: string;
|
||||
country: string;
|
||||
@ -58,6 +65,7 @@ export interface SimplifiedGeoIPResponse {
|
||||
export interface DetailedGeoIPResponse {
|
||||
ip: string;
|
||||
location: GeoIPLocation;
|
||||
asn: AsnInfo;
|
||||
}
|
||||
|
||||
export interface BatchGeoIPRequest {
|
||||
|
Loading…
x
Reference in New Issue
Block a user