|
|
@@ -4,22 +4,21 @@ import { compareAndWriteFile, withBannerArray } from './lib/create-file';
|
|
|
import { processLineFromReadline } from './lib/process-line';
|
|
|
import { task } from './lib/trace-runner';
|
|
|
|
|
|
+import { exclude } from 'fast-cidr-tools';
|
|
|
+
|
|
|
// https://github.com/misakaio/chnroutes2/issues/25
|
|
|
const EXCLUDE_CIDRS = [
|
|
|
'223.118.0.0/15',
|
|
|
'223.120.0.0/15'
|
|
|
];
|
|
|
|
|
|
-// preload the module
|
|
|
-import('cidr-tools-wasm');
|
|
|
+const INCLUDE_CIDRS = [
|
|
|
+ '211.99.96.0/19' // wy.com.cn
|
|
|
+];
|
|
|
|
|
|
export const buildChnCidr = task(import.meta.path, async () => {
|
|
|
- const [{ exclude }, cidr] = await Promise.all([
|
|
|
- import('cidr-tools-wasm'),
|
|
|
- processLineFromReadline(await fetchRemoteTextAndCreateReadlineInterface('https://raw.githubusercontent.com/misakaio/chnroutes2/master/chnroutes.txt'))
|
|
|
- ]);
|
|
|
-
|
|
|
- const filteredCidr = exclude(cidr, EXCLUDE_CIDRS, true);
|
|
|
+ const cidr = await processLineFromReadline(await fetchRemoteTextAndCreateReadlineInterface('https://raw.githubusercontent.com/misakaio/chnroutes2/master/chnroutes.txt'));
|
|
|
+ const filteredCidr = exclude([...cidr, ...INCLUDE_CIDRS], EXCLUDE_CIDRS, true);
|
|
|
|
|
|
// Can not use SHARED_DESCRIPTION here as different license
|
|
|
const description = [
|