Autonomous System information in Geolocation function

I am looking for a convenient way to get the ASN of the client IP that is connecting to my service.

While I can import a thrid party ip-to-asn database and query via hosted sql, there should be a way to include this minimal extra information in the provided @vercel/geoloation function to save on compute and network usage, limit dependencies, and simplify deployment.

Current versus Expected behavior

import { geolocation } from '@vercel/functions';
 
export function GET(request) {
  const details = geolocation(request);
  return Response.json(details);
}
{
  "city": "New York",
  "country": "US",
  "flag": "🇺🇸",
  "countryRegion": "NY",
  "region": "dev1",
  "latitude": "40.7128",
  "longitude": "-74.0060"
+ "asn": "7922",
+ "as": "Comcast Cable Communications, LLC",
}
1 Like

Thanks for the feedback, @jmwample! I’ll pass it on internally :pray:

Has there been any update on this? It seems like the documentation for the function is unchanged.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.