Next.js+React web interface for controlling HAProxy clusters (groups of servers), in conjunction with with https://gitgud.io/fatchan/haproxy-protection.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
500 B
18 lines
500 B
import { readFileSync, writeFileSync } from 'fs';
|
|
|
|
const data = readFileSync('./asn.map', { encoding: 'utf8', flag: 'r' });
|
|
const lines = data.split('\n');
|
|
const asnMap = lines.reduce((acc, line) => {
|
|
const split = line.split(',');
|
|
const asn = split.shift();
|
|
let name = split.join(',');
|
|
if (name.startsWith('"')) {
|
|
name = name
|
|
.substring(1, name.length-1)
|
|
.replaceAll('""', '"');
|
|
}
|
|
acc[asn] = name;
|
|
return acc;
|
|
}, {});
|
|
|
|
writeFileSync('./asn.json', JSON.stringify(asnMap, null, '\t'));
|
|
|