mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-13 01:30:37 +08:00
Update CDN & Reject Hosts, Reject IPs
This commit is contained in:
parent
32e27a579b
commit
deb0169846
@ -3,11 +3,12 @@ import path from 'node:path';
|
|||||||
import { createReadlineInterfaceFromResponse, readFileIntoProcessedArray } from './lib/fetch-text-by-line';
|
import { createReadlineInterfaceFromResponse, readFileIntoProcessedArray } from './lib/fetch-text-by-line';
|
||||||
import { task } from './trace';
|
import { task } from './trace';
|
||||||
import { SHARED_DESCRIPTION } from './constants/description';
|
import { SHARED_DESCRIPTION } from './constants/description';
|
||||||
import { RulesetOutput } from './lib/create-file';
|
import { compareAndWriteFile, RulesetOutput } from './lib/create-file';
|
||||||
import { SOURCE_DIR } from './constants/dir';
|
import { OUTPUT_INTERNAL_DIR, SOURCE_DIR } from './constants/dir';
|
||||||
import { $$fetch } from './lib/fetch-retry';
|
import { $$fetch } from './lib/fetch-retry';
|
||||||
import { fetchAssets } from './lib/fetch-assets';
|
import { fetchAssets } from './lib/fetch-assets';
|
||||||
import { fastIpVersion } from './lib/misc';
|
import { fastIpVersion } from './lib/misc';
|
||||||
|
import { AUGUST_ASN } from '../Source/ip/august';
|
||||||
|
|
||||||
const BOGUS_NXDOMAIN_URL = 'https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/bogus-nxdomain.china.conf';
|
const BOGUS_NXDOMAIN_URL = 'https://raw.githubusercontent.com/felixonmars/dnsmasq-china-list/master/bogus-nxdomain.china.conf';
|
||||||
const getBogusNxDomainIPsPromise: Promise<[ipv4: string[], ipv6: string[]]> = $$fetch(BOGUS_NXDOMAIN_URL).then(async (resp) => {
|
const getBogusNxDomainIPsPromise: Promise<[ipv4: string[], ipv6: string[]]> = $$fetch(BOGUS_NXDOMAIN_URL).then(async (resp) => {
|
||||||
@ -55,21 +56,25 @@ export const buildRejectIPList = task(require.main === module, __filename)(async
|
|||||||
span.traceChildPromise('get botnet ips', getBotNetFilterIPsPromise)
|
span.traceChildPromise('get botnet ips', getBotNetFilterIPsPromise)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return new RulesetOutput(span, 'reject', 'ip')
|
return Promise.all([
|
||||||
.withTitle('Sukka\'s Ruleset - Anti Bogus Domain')
|
new RulesetOutput(span, 'reject', 'ip')
|
||||||
.withDescription([
|
.withTitle('Sukka\'s Ruleset - Anti Bogus Domain')
|
||||||
...SHARED_DESCRIPTION,
|
.withDescription([
|
||||||
'',
|
...SHARED_DESCRIPTION,
|
||||||
'This file contains known addresses that are hijacking NXDOMAIN results returned by DNS servers, and botnet controller IPs.',
|
'',
|
||||||
'',
|
'This file contains known addresses that are hijacking NXDOMAIN results returned by DNS servers, and botnet controller IPs.',
|
||||||
'Data from:',
|
'',
|
||||||
' - https://github.com/felixonmars/dnsmasq-china-list',
|
'Data from:',
|
||||||
' - https://github.com/curbengh/botnet-filter'
|
' - https://github.com/felixonmars/dnsmasq-china-list',
|
||||||
])
|
' - https://github.com/curbengh/botnet-filter'
|
||||||
.addFromRuleset(readLocalRejectIpListPromise)
|
])
|
||||||
.bulkAddCIDR4NoResolve(bogusNxDomainIPs[0])
|
.addFromRuleset(readLocalRejectIpListPromise)
|
||||||
.bulkAddCIDR6NoResolve(bogusNxDomainIPs[1])
|
.bulkAddCIDR4NoResolve(bogusNxDomainIPs[0])
|
||||||
.bulkAddCIDR4NoResolve(botNetIPs[0])
|
.bulkAddCIDR6NoResolve(bogusNxDomainIPs[1])
|
||||||
.bulkAddCIDR6NoResolve(botNetIPs[1])
|
.bulkAddCIDR4NoResolve(botNetIPs[0])
|
||||||
.write();
|
.bulkAddCIDR6NoResolve(botNetIPs[1])
|
||||||
|
.bulkAddIPASN(AUGUST_ASN)
|
||||||
|
.write(),
|
||||||
|
compareAndWriteFile(span, [AUGUST_ASN.join(' ')], path.join(OUTPUT_INTERNAL_DIR, 'august_asn.txt'))
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -123,6 +123,18 @@ export abstract class RuleOutput<TPreprocessed = unknown> {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addIPASN(asn: string) {
|
||||||
|
this.ipasn.add(asn);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bulkAddIPASN(asns: string[]) {
|
||||||
|
for (let i = 0, len = asns.length; i < len; i++) {
|
||||||
|
this.ipasn.add(asns[i]);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
private async addFromDomainsetPromise(source: AsyncIterable<string> | Iterable<string> | string[]) {
|
private async addFromDomainsetPromise(source: AsyncIterable<string> | Iterable<string> | string[]) {
|
||||||
for await (const line of source) {
|
for await (const line of source) {
|
||||||
if (line[0] === '.') {
|
if (line[0] === '.') {
|
||||||
|
|||||||
@ -4027,3 +4027,4 @@ fdn.gsmarena.com
|
|||||||
fdn2.gsmarena.com
|
fdn2.gsmarena.com
|
||||||
static.fbot.me
|
static.fbot.me
|
||||||
nav.yumenosora.co.jp
|
nav.yumenosora.co.jp
|
||||||
|
.hgimg00.com
|
||||||
|
|||||||
12
Source/ip/august.ts
Normal file
12
Source/ip/august.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export const AUGUST_ASN = [
|
||||||
|
'1012', // Moe BGP, peers with both AS40111 and AS945
|
||||||
|
'945', // hkgo LLC, peers with AS1012
|
||||||
|
'401111', // peers with both AS1012 and AS945
|
||||||
|
'62853', // hkgo LLC, peers with AS945
|
||||||
|
'27523', // Kawaii Networks, peers with AS945
|
||||||
|
'7719', // hkgo LLC
|
||||||
|
'54625', // peers with AS945
|
||||||
|
'7257', // only upstream is AS945
|
||||||
|
'18044', // only upstream is AS945
|
||||||
|
'62489' // only upstream is AS945 and AS1012
|
||||||
|
];
|
||||||
@ -127,6 +127,16 @@ DOMAIN-WILDCARD,adv0*.msa.cdn.mediaset.net
|
|||||||
DOMAIN-SUFFIX,juejin.im
|
DOMAIN-SUFFIX,juejin.im
|
||||||
DOMAIN-SUFFIX,juejin.cn
|
DOMAIN-SUFFIX,juejin.cn
|
||||||
|
|
||||||
|
# >> hkgo LLC, a.k.a. August Internet
|
||||||
|
DOMAIN-SUFFIX,pgi.com
|
||||||
|
DOMAIN-SUFFIX,wakuwaku.ne.jp
|
||||||
|
DOMAIN-SUFFIX,bgp.co
|
||||||
|
DOMAIN-SUFFIX,moebgp.com
|
||||||
|
DOMAIN-SUFFIX,august.tw
|
||||||
|
DOMAIN-SUFFIX,esgltc.com
|
||||||
|
DOMAIN-SUFFIX,kimo.tw
|
||||||
|
DOMAIN-SUFFIX,lambda-ix.net
|
||||||
|
|
||||||
# >> Google
|
# >> Google
|
||||||
# DOMAIN-KEYWORD,adsense # unblocks adsense.google.com
|
# DOMAIN-KEYWORD,adsense # unblocks adsense.google.com
|
||||||
DOMAIN-KEYWORD,adwords
|
DOMAIN-KEYWORD,adwords
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user