|
|
@@ -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`;
|
|
|
}
|