mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 17:20:35 +08:00
Feat: add China IPv6 list
This commit is contained in:
parent
ffb92989fa
commit
2db87bd57d
@ -10,22 +10,22 @@ import { CN_CIDR_NOT_INCLUDED_IN_CHNROUTE, NON_CN_CIDR_INCLUDED_IN_CHNROUTE } fr
|
|||||||
import { appendArrayInPlace } from './lib/append-array-in-place';
|
import { appendArrayInPlace } from './lib/append-array-in-place';
|
||||||
|
|
||||||
export const getChnCidrPromise = createMemoizedPromise(async () => {
|
export const getChnCidrPromise = createMemoizedPromise(async () => {
|
||||||
const cidr = await processLineFromReadline(await fetchRemoteTextByLine('https://raw.githubusercontent.com/misakaio/chnroutes2/master/chnroutes.txt'));
|
const cidr4 = await processLineFromReadline(await fetchRemoteTextByLine('https://raw.githubusercontent.com/misakaio/chnroutes2/master/chnroutes.txt'));
|
||||||
|
const cidr6 = await processLineFromReadline(await fetchRemoteTextByLine('https://gaoyifan.github.io/china-operator-ip/china6.txt'));
|
||||||
|
|
||||||
appendArrayInPlace(cidr, CN_CIDR_NOT_INCLUDED_IN_CHNROUTE);
|
appendArrayInPlace(cidr4, CN_CIDR_NOT_INCLUDED_IN_CHNROUTE);
|
||||||
return exclude(cidr, NON_CN_CIDR_INCLUDED_IN_CHNROUTE, true);
|
return [exclude(cidr4, NON_CN_CIDR_INCLUDED_IN_CHNROUTE, true), cidr6] as const;
|
||||||
});
|
});
|
||||||
|
|
||||||
export const buildChnCidr = task(require.main === module, __filename)(async (span) => {
|
export const buildChnCidr = task(require.main === module, __filename)(async (span) => {
|
||||||
const filteredCidr = await span.traceChildAsync('download chnroutes2', getChnCidrPromise);
|
const [filteredCidr4, cidr6] = await span.traceChildAsync('download chnroutes2', getChnCidrPromise);
|
||||||
|
|
||||||
// Can not use SHARED_DESCRIPTION here as different license
|
// Can not use SHARED_DESCRIPTION here as different license
|
||||||
const description = [
|
const description = [
|
||||||
'License: CC BY-SA 2.0',
|
'License: CC BY-SA 2.0',
|
||||||
'Homepage: https://ruleset.skk.moe',
|
'Homepage: https://ruleset.skk.moe',
|
||||||
'GitHub: https://github.com/SukkaW/Surge',
|
'GitHub: https://github.com/SukkaW/Surge',
|
||||||
'',
|
''
|
||||||
'Data from https://misaka.io (misakaio @ GitHub)'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Can not use createRuleset here, as Clash support advanced ipset syntax
|
// Can not use createRuleset here, as Clash support advanced ipset syntax
|
||||||
@ -34,9 +34,12 @@ export const buildChnCidr = task(require.main === module, __filename)(async (spa
|
|||||||
span,
|
span,
|
||||||
withBannerArray(
|
withBannerArray(
|
||||||
'Sukka\'s Ruleset - Mainland China IPv4 CIDR',
|
'Sukka\'s Ruleset - Mainland China IPv4 CIDR',
|
||||||
description,
|
[
|
||||||
|
...description,
|
||||||
|
'Data from https://misaka.io (misakaio @ GitHub)'
|
||||||
|
],
|
||||||
new Date(),
|
new Date(),
|
||||||
filteredCidr.map(i => `IP-CIDR,${i}`)
|
filteredCidr4.map(i => `IP-CIDR,${i}`)
|
||||||
),
|
),
|
||||||
pathResolve(__dirname, '../List/ip/china_ip.conf')
|
pathResolve(__dirname, '../List/ip/china_ip.conf')
|
||||||
),
|
),
|
||||||
@ -44,11 +47,40 @@ export const buildChnCidr = task(require.main === module, __filename)(async (spa
|
|||||||
span,
|
span,
|
||||||
withBannerArray(
|
withBannerArray(
|
||||||
'Sukka\'s Ruleset - Mainland China IPv4 CIDR',
|
'Sukka\'s Ruleset - Mainland China IPv4 CIDR',
|
||||||
description,
|
[
|
||||||
|
...description,
|
||||||
|
'Data from https://github.com/gaoyifan/china-operator-ip'
|
||||||
|
],
|
||||||
new Date(),
|
new Date(),
|
||||||
filteredCidr
|
filteredCidr4.map(i => `IP-CIDR6,${i}`)
|
||||||
|
),
|
||||||
|
pathResolve(__dirname, '../List/ip/china_ip_ipv6.conf')
|
||||||
|
),
|
||||||
|
compareAndWriteFile(
|
||||||
|
span,
|
||||||
|
withBannerArray(
|
||||||
|
'Sukka\'s Ruleset - Mainland China IPv4 CIDR',
|
||||||
|
[
|
||||||
|
...description,
|
||||||
|
'Data from https://misaka.io (misakaio @ GitHub)'
|
||||||
|
],
|
||||||
|
new Date(),
|
||||||
|
cidr6
|
||||||
),
|
),
|
||||||
pathResolve(__dirname, '../Clash/ip/china_ip.txt')
|
pathResolve(__dirname, '../Clash/ip/china_ip.txt')
|
||||||
|
),
|
||||||
|
compareAndWriteFile(
|
||||||
|
span,
|
||||||
|
withBannerArray(
|
||||||
|
'Sukka\'s Ruleset - Mainland China IPv4 CIDR',
|
||||||
|
[
|
||||||
|
...description,
|
||||||
|
'Data from https://github.com/gaoyifan/china-operator-ip'
|
||||||
|
],
|
||||||
|
new Date(),
|
||||||
|
cidr6
|
||||||
|
),
|
||||||
|
pathResolve(__dirname, '../Clash/ip/china_ip_ipv6.txt')
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { NON_CN_CIDR_INCLUDED_IN_CHNROUTE, RESERVED_IPV4_CIDR } from './constant
|
|||||||
import { writeFile } from './lib/misc';
|
import { writeFile } from './lib/misc';
|
||||||
|
|
||||||
export const buildInternalReverseChnCIDR = task(require.main === module, __filename)(async () => {
|
export const buildInternalReverseChnCIDR = task(require.main === module, __filename)(async () => {
|
||||||
const cidr = await getChnCidrPromise();
|
const [cidr] = await getChnCidrPromise();
|
||||||
|
|
||||||
const reversedCidr = merge(
|
const reversedCidr = merge(
|
||||||
exclude(
|
exclude(
|
||||||
|
|||||||
@ -68,7 +68,10 @@ export const buildSSPanelUIMAppProfile = task(require.main === module, __filenam
|
|||||||
readFileIntoProcessedArray(path.resolve(__dirname, '../Source/non_ip/global.conf')).then(surgeRulesetToClashClassicalTextRuleset),
|
readFileIntoProcessedArray(path.resolve(__dirname, '../Source/non_ip/global.conf')).then(surgeRulesetToClashClassicalTextRuleset),
|
||||||
readFileIntoProcessedArray(path.resolve(__dirname, '../Source/non_ip/telegram.conf')).then(surgeRulesetToClashClassicalTextRuleset),
|
readFileIntoProcessedArray(path.resolve(__dirname, '../Source/non_ip/telegram.conf')).then(surgeRulesetToClashClassicalTextRuleset),
|
||||||
// domestic - ip cidr
|
// domestic - ip cidr
|
||||||
getChnCidrPromise().then(cidrs => cidrs.map(cidr => `IP-CIDR,${cidr}`)),
|
getChnCidrPromise().then(([cidrs4, cidrs6]) => [
|
||||||
|
...cidrs4.map(cidr => `IP-CIDR,${cidr}`),
|
||||||
|
...cidrs6.map(cidr => `IP-CIDR,${cidr}`)
|
||||||
|
]),
|
||||||
AllStreamServices.flatMap((i) => (
|
AllStreamServices.flatMap((i) => (
|
||||||
i.ip
|
i.ip
|
||||||
? [
|
? [
|
||||||
|
|||||||
16
README.md
16
README.md
@ -710,13 +710,15 @@ rules:
|
|||||||
#### chnroute CIDR
|
#### chnroute CIDR
|
||||||
|
|
||||||
- 自动生成
|
- 自动生成
|
||||||
- [原始数据](https://github.com/misakaio/chnroutes2) 由 Misaka Network, Inc.、DMIT, Inc.、NEROCLOUD Ltd.、Rainbow network Ltd.、MOACK Co., Ltd. 提供,由 Misaka Network, Inc. 整理,以 [CC BY-SA 2.0](https://creativecommons.org/licenses/by-sa/2.0/) 协议发布
|
- IPv4 [原始数据](https://github.com/misakaio/chnroutes2) 由 Misaka Network, Inc. 以 [CC BY-SA 2.0](https://creativecommons.org/licenses/by-sa/2.0/) 协议发布,二次处理补充合并了 Misaka Network, Inc. 收不到 BGP 路由的部分国内段、排除了被 Misaka Network, Inc. 误收的在香港广播的 IP 段(通常由 中国移动国际 CMI 广播)
|
||||||
- 二次处理:补充合并了 Misaka Network, Inc. 收不到 BGP 路由的部分国内段、排除了被 Misaka Network, Inc. 误收的在香港广播的 IP 段(通常由 中国移动国际 CMI 广播)
|
- IPv6 原始数据 由 [gaoyifan/china-operator-ip](https://github.com/gaoyifan/china-operator-ip) 以 MIT 协议发布
|
||||||
|
|
||||||
**Surge**
|
**Surge**
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
RULE-SET,https://ruleset.skk.moe/List/ip/china_ip.conf,[Replace with your policy]
|
RULE-SET,https://ruleset.skk.moe/List/ip/china_ip.conf,[Replace with your policy]
|
||||||
|
# Only use it if you are using IPv6
|
||||||
|
# RULE-SET,https://ruleset.skk.moe/List/ip/china_ip_ipv6.conf,[Replace with your policy]
|
||||||
```
|
```
|
||||||
|
|
||||||
**Clash Premium**
|
**Clash Premium**
|
||||||
@ -730,9 +732,17 @@ rule-providers:
|
|||||||
interval: 43200
|
interval: 43200
|
||||||
url: https://ruleset.skk.moe/Clash/ip/china_ip.txt
|
url: https://ruleset.skk.moe/Clash/ip/china_ip.txt
|
||||||
path: ./sukkaw_ruleset/china_ip.txt
|
path: ./sukkaw_ruleset/china_ip.txt
|
||||||
|
china_ip_ipv6:
|
||||||
|
type: http
|
||||||
|
behavior: ipcidr
|
||||||
|
format: text
|
||||||
|
interval: 43200
|
||||||
|
url: https://ruleset.skk.moe/Clash/ip/china_ip_ipv6.txt
|
||||||
|
path: ./sukkaw_ruleset/china_ip.txt
|
||||||
rules:
|
rules:
|
||||||
- RULE-SET,china_ip,[Replace with your policy]
|
- RULE-SET,china_ip,[Replace with your policy]
|
||||||
|
# Only use it if you are using IPv6
|
||||||
|
# - RULE-SET,china_ip_ipv6,[Replace with your policy]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Surge 模块列表
|
## Surge 模块列表
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user