diff --git a/src/backend/services/geoip.ts b/src/backend/services/geoip.ts index 79f3722..3197987 100644 --- a/src/backend/services/geoip.ts +++ b/src/backend/services/geoip.ts @@ -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); diff --git a/src/backend/types/index.ts b/src/backend/types/index.ts index cadf631..42012df 100644 --- a/src/backend/types/index.ts +++ b/src/backend/types/index.ts @@ -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 {