fetchBgpHeNet moved as-is, not removed, despite being confirmed dead code in practice (its only call site in /api/lookup is hardcoded to Promise.resolve(null)) -- that's a "disabled pending re-enable" state, a bigger behavioral decision than this extraction pass should make alone. Also widened the smoke-test harness's volatile-path exclusions: the live Cloudflare RPKI feed's ASPA object count ticks between runs (independent of any code change here), and the field appears under three different names (aspa_map.entries, aspa_adoption.total_objects, plus the derived delta_from_previous) that weren't all covered by the existing aspa_objects exclusion. Re-captured baseline accordingly. Verified via smoke-test harness (28/28 match). server.js: 4827 -> 4575 lines.
24 lines
808 B
JavaScript
24 lines
808 B
JavaScript
const { fetchRipeStatCached } = require("./services/ripe-stat");
|
|
|
|
// Batch resolve AS names via RIPE Stat AS overview API
|
|
async function resolveASNames(providers) {
|
|
const batchSize = 10;
|
|
for (let i = 0; i < providers.length; i += batchSize) {
|
|
const batch = providers.slice(i, i + batchSize);
|
|
const results = await Promise.all(
|
|
batch.map(p =>
|
|
fetchRipeStatCached("https://stat.ripe.net/data/as-overview/data.json?resource=AS" + p.asn)
|
|
.then(r => ({ asn: p.asn, name: r?.data?.holder || "" }))
|
|
.catch(() => ({ asn: p.asn, name: "" }))
|
|
)
|
|
);
|
|
results.forEach(r => {
|
|
const provider = providers.find(p => p.asn === r.asn);
|
|
if (provider && r.name) provider.name = r.name;
|
|
});
|
|
}
|
|
return providers;
|
|
}
|
|
|
|
module.exports = { resolveASNames };
|