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",
}