Feat: auto generate Telegram CIDR list

This commit is contained in:
SukkaW 2022-04-23 21:40:13 +08:00
parent c69673f468
commit 045be0a736
5 changed files with 40 additions and 10 deletions

View File

@ -29,6 +29,7 @@ jobs:
- run: node ./Build/build-apple-cdn.js - run: node ./Build/build-apple-cdn.js
- run: node ./Build/build-cidr.js - run: node ./Build/build-cidr.js
- run: node ./Build/build-reject-domainset.js - run: node ./Build/build-reject-domainset.js
- run: node ./Build/build-telegram-cidr.js
- run: node ./Build/build-index.html.js - run: node ./Build/build-index.html.js
- name: Deploy - name: Deploy
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3

View File

@ -0,0 +1,24 @@
const { fetch } = require('undici');
const fs = require('fs');
const path = require('path');
(async () => {
const resp = await fetch('https://core.telegram.org/resources/cidr.txt');
const lastModified = new Date(resp.headers.get('last-modified'));
const res = (await resp.text())
.split('\n')
.filter(line => line.trim() !== '');
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 => {
return ip.includes(':')
? `IP-CIDR6,${ip},no-resolve`
: `IP-CIDR,${ip},no-resolve`;
}).join('\n') + '\n',
'utf-8'
);
})();

View File

@ -1,13 +1,16 @@
# > Telegram # Telegram CIDR (https://core.telegram.org/resources/cidr.txt)
IP-CIDR,91.105.192.0/23,no-resolve # Last Updated: 2021-10-01T16:51:55.000Z
IP-CIDR,91.108.0.0/16,no-resolve IP-CIDR,91.108.56.0/22,no-resolve
IP-CIDR,95.161.64.0/20,no-resolve IP-CIDR,91.108.4.0/22,no-resolve
IP-CIDR,109.239.140.0/24,no-resolve IP-CIDR,91.108.8.0/22,no-resolve
IP-CIDR,91.108.16.0/22,no-resolve
IP-CIDR,91.108.12.0/22,no-resolve
IP-CIDR,149.154.160.0/20,no-resolve IP-CIDR,149.154.160.0/20,no-resolve
IP-CIDR,91.105.192.0/23,no-resolve
IP-CIDR,91.108.20.0/22,no-resolve
IP-CIDR,185.76.151.0/24,no-resolve IP-CIDR,185.76.151.0/24,no-resolve
IP-CIDR,214.218.41.9/32,no-resolve
IP-CIDR6,2001:67c:4e8::/48,no-resolve
IP-CIDR6,2001:b28:f23c::/48,no-resolve
IP-CIDR6,2001:b28:f23d::/48,no-resolve IP-CIDR6,2001:b28:f23d::/48,no-resolve
IP-CIDR6,2001:b28:f23f::/48,no-resolve IP-CIDR6,2001:b28:f23f::/48,no-resolve
IP-CIDR6,2a0a:f280:203::/48,no-resolve IP-CIDR6,2001:67c:4e8::/48,no-resolve
IP-CIDR6,2001:b28:f23c::/48,no-resolve
IP-CIDR6,2a0a:f280::/32,no-resolve

View File

@ -7,3 +7,4 @@ DOMAIN-SUFFIX,telegram.me
DOMAIN-SUFFIX,telegram.org DOMAIN-SUFFIX,telegram.org
DOMAIN-SUFFIX,graph.org DOMAIN-SUFFIX,graph.org
DOMAIN-SUFFIX,legra.ph DOMAIN-SUFFIX,legra.ph
DOMAIN-SUFFIX,telesco.pe

View File

@ -67,7 +67,8 @@ RULE-SET,https://ruleset.skk.moe/List/non_ip/telegram.conf,[Replace with your po
RULE-SET,https://ruleset.skk.moe/List/ip/telegram.conf,[Replace with your policy] RULE-SET,https://ruleset.skk.moe/List/ip/telegram.conf,[Replace with your policy]
``` ```
- 人工维护 - 域名规则 人工维护
- IP CIDR 规则 自动生成(数据来源:[`https://core.telegram.org/resources/cidr.txt`](https://core.telegram.org/resources/cidr.txt)
#### Apple CDN #### Apple CDN