mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-13 01:30:37 +08:00
Chore: debug telegram cidr update
This commit is contained in:
parent
cd5525b560
commit
e93a801bf7
@ -13,12 +13,17 @@ const { isIPv4, isIPv6 } = require('net');
|
||||
.split('\n')
|
||||
.filter(line => line.trim() !== '');
|
||||
|
||||
if (res.length === 0) {
|
||||
throw new Error('Failed to fetch data!');
|
||||
}
|
||||
|
||||
await fs.promises.writeFile(
|
||||
path.resolve(__dirname, '../List/ip/telegram.conf'),
|
||||
'# Telegram CIDR (https://core.telegram.org/resources/cidr.txt)' + '\n' +
|
||||
'# Last Updated: ' + lastModified.toISOString() + '\n' +
|
||||
res.map(ip => {
|
||||
const [subnet] = ip.split('/');
|
||||
console.log(' - ' + ip + ': ' + subnet);
|
||||
if (isIPv4(subnet)) {
|
||||
return `IP-CIDR,${ip},no-resolve`;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user