parse-filter.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. // @ts-check
  2. import { fetchRemoteTextByLine } from './fetch-text-by-line';
  3. import { NetworkFilter } from '@cliqz/adblocker';
  4. import { processLine } from './process-line';
  5. import { getGorhillPublicSuffixPromise } from './get-gorhill-publicsuffix';
  6. import type { PublicSuffixList } from '@gorhill/publicsuffixlist';
  7. import { traceAsync } from './trace-runner';
  8. import picocolors from 'picocolors';
  9. import { normalizeDomain } from './normalize-domain';
  10. import { fetchAssets } from './fetch-assets';
  11. import { deserializeSet, fsCache, serializeSet } from './cache-filesystem';
  12. const DEBUG_DOMAIN_TO_FIND: string | null = null; // example.com | null
  13. let foundDebugDomain = false;
  14. export function processDomainLists(domainListsUrl: string, includeAllSubDomain = false, ttl: number | null = null) {
  15. return traceAsync(`- processDomainLists: ${domainListsUrl}`, () => fsCache.apply(
  16. domainListsUrl,
  17. async () => {
  18. const domainSets = new Set<string>();
  19. for await (const line of await fetchRemoteTextByLine(domainListsUrl)) {
  20. const domainToAdd = processLine(line);
  21. if (!domainToAdd) continue;
  22. if (DEBUG_DOMAIN_TO_FIND && domainToAdd.includes(DEBUG_DOMAIN_TO_FIND)) {
  23. console.warn(picocolors.red(domainListsUrl), '(black)', picocolors.bold(DEBUG_DOMAIN_TO_FIND));
  24. foundDebugDomain = true;
  25. }
  26. domainSets.add(includeAllSubDomain ? `.${domainToAdd}` : domainToAdd);
  27. }
  28. return domainSets;
  29. },
  30. {
  31. ttl,
  32. temporaryBypass: DEBUG_DOMAIN_TO_FIND !== null,
  33. serializer: serializeSet,
  34. deserializer: deserializeSet
  35. }
  36. ));
  37. }
  38. export function processHosts(hostsUrl: string, includeAllSubDomain = false, skipDomainCheck = false, ttl: number | null = null) {
  39. return traceAsync(`- processHosts: ${hostsUrl}`, () => fsCache.apply(
  40. hostsUrl,
  41. async () => {
  42. const domainSets = new Set<string>();
  43. for await (const l of await fetchRemoteTextByLine(hostsUrl)) {
  44. const line = processLine(l);
  45. if (!line) {
  46. continue;
  47. }
  48. const domain = line.split(/\s/)[1];
  49. if (!domain) {
  50. continue;
  51. }
  52. const _domain = domain.trim();
  53. if (DEBUG_DOMAIN_TO_FIND && _domain.includes(DEBUG_DOMAIN_TO_FIND)) {
  54. console.warn(picocolors.red(hostsUrl), '(black)', picocolors.bold(DEBUG_DOMAIN_TO_FIND));
  55. foundDebugDomain = true;
  56. }
  57. const domainToAdd = skipDomainCheck ? _domain : normalizeDomain(_domain);
  58. if (domainToAdd) {
  59. domainSets.add(includeAllSubDomain ? `.${domainToAdd}` : domainToAdd);
  60. }
  61. }
  62. console.log(picocolors.gray('[process hosts]'), picocolors.gray(hostsUrl), picocolors.gray(domainSets.size));
  63. return domainSets;
  64. },
  65. {
  66. ttl,
  67. temporaryBypass: DEBUG_DOMAIN_TO_FIND !== null,
  68. serializer: serializeSet,
  69. deserializer: deserializeSet
  70. }
  71. ));
  72. }
  73. // eslint-disable-next-line sukka-ts/no-const-enum -- bun bundler is smart, maybe?
  74. const enum ParseType {
  75. WhiteIncludeSubdomain = 0,
  76. WhiteAbsolute = -1,
  77. BlackAbsolute = 1,
  78. BlackIncludeSubdomain = 2,
  79. ErrorMessage = 10
  80. }
  81. export async function processFilterRules(
  82. filterRulesUrl: string,
  83. fallbackUrls?: readonly string[] | undefined | null,
  84. ttl: number | null = null
  85. ): Promise<{ white: string[], black: string[], foundDebugDomain: boolean }> {
  86. const [white, black, warningMessages] = await traceAsync(`- processFilterRules: ${filterRulesUrl}`, () => fsCache.apply<[
  87. white: string[],
  88. black: string[],
  89. warningMessages: string[]
  90. ]>(
  91. filterRulesUrl,
  92. async () => {
  93. const whitelistDomainSets = new Set<string>();
  94. const blacklistDomainSets = new Set<string>();
  95. const warningMessages: string[] = [];
  96. const gorhill = await getGorhillPublicSuffixPromise();
  97. /**
  98. * @param {string} line
  99. */
  100. const lineCb = (line: string) => {
  101. const result = parse(line, gorhill);
  102. if (!result) {
  103. return;
  104. }
  105. const flag = result[1];
  106. const hostname = result[0];
  107. if (DEBUG_DOMAIN_TO_FIND) {
  108. if (hostname.includes(DEBUG_DOMAIN_TO_FIND)) {
  109. console.warn(
  110. picocolors.red(filterRulesUrl),
  111. flag === ParseType.WhiteIncludeSubdomain || flag === ParseType.WhiteAbsolute
  112. ? '(white)'
  113. : '(black)',
  114. picocolors.bold(DEBUG_DOMAIN_TO_FIND)
  115. );
  116. foundDebugDomain = true;
  117. }
  118. }
  119. switch (flag) {
  120. case ParseType.WhiteIncludeSubdomain:
  121. if (hostname[0] !== '.') {
  122. whitelistDomainSets.add(`.${hostname}`);
  123. } else {
  124. whitelistDomainSets.add(hostname);
  125. }
  126. break;
  127. case ParseType.WhiteAbsolute:
  128. whitelistDomainSets.add(hostname);
  129. break;
  130. case ParseType.BlackAbsolute:
  131. blacklistDomainSets.add(hostname);
  132. break;
  133. case ParseType.BlackIncludeSubdomain:
  134. if (hostname[0] !== '.') {
  135. blacklistDomainSets.add(`.${hostname}`);
  136. } else {
  137. blacklistDomainSets.add(hostname);
  138. }
  139. break;
  140. case ParseType.ErrorMessage:
  141. warningMessages.push(hostname);
  142. break;
  143. default:
  144. break;
  145. }
  146. };
  147. // TODO-SUKKA: add cache here
  148. if (!fallbackUrls || fallbackUrls.length === 0) {
  149. for await (const line of await fetchRemoteTextByLine(filterRulesUrl)) {
  150. // don't trim here
  151. lineCb(line);
  152. }
  153. } else {
  154. const filterRules = (await traceAsync(
  155. picocolors.gray(`- download ${filterRulesUrl}`),
  156. () => fetchAssets(filterRulesUrl, fallbackUrls),
  157. picocolors.gray
  158. )).split('\n');
  159. const key = picocolors.gray(`- parse adguard filter ${filterRulesUrl}`);
  160. console.time(key);
  161. for (let i = 0, len = filterRules.length; i < len; i++) {
  162. lineCb(filterRules[i]);
  163. }
  164. console.timeEnd(key);
  165. }
  166. return [
  167. Array.from(whitelistDomainSets),
  168. Array.from(blacklistDomainSets),
  169. warningMessages
  170. ];
  171. },
  172. {
  173. ttl,
  174. temporaryBypass: DEBUG_DOMAIN_TO_FIND !== null,
  175. serializer: JSON.stringify,
  176. deserializer: JSON.parse
  177. }
  178. ));
  179. warningMessages.forEach(msg => {
  180. console.warn(
  181. picocolors.yellow(msg),
  182. picocolors.gray(picocolors.underline(filterRulesUrl))
  183. );
  184. });
  185. console.log(
  186. picocolors.gray('[process filter]'),
  187. picocolors.gray(filterRulesUrl),
  188. picocolors.gray(`white: ${white.length}`),
  189. picocolors.gray(`black: ${black.length}`)
  190. );
  191. return {
  192. white,
  193. black,
  194. foundDebugDomain
  195. };
  196. }
  197. const R_KNOWN_NOT_NETWORK_FILTER_PATTERN = /[#%&=~]/;
  198. const R_KNOWN_NOT_NETWORK_FILTER_PATTERN_2 = /(\$popup|\$removeparam|\$popunder|\$cname)/;
  199. // cname exceptional filter can not be parsed by NetworkFilter
  200. // Surge / Clash can't handle CNAME either, so we just ignore them
  201. function parse($line: string, gorhill: PublicSuffixList): null | [hostname: string, flag: ParseType] {
  202. if (
  203. // doesn't include
  204. !$line.includes('.') // rule with out dot can not be a domain
  205. // includes
  206. || $line.includes('!')
  207. || $line.includes('?')
  208. || $line.includes('*')
  209. || $line.includes('[')
  210. || $line.includes('(')
  211. || $line.includes(']')
  212. || $line.includes(')')
  213. || $line.includes(',')
  214. || R_KNOWN_NOT_NETWORK_FILTER_PATTERN.test($line)
  215. ) {
  216. return null;
  217. }
  218. const line = $line.trim();
  219. /** @example line.length */
  220. const len = line.length;
  221. if (len === 0) {
  222. return null;
  223. }
  224. const firstCharCode = line[0].charCodeAt(0);
  225. const lastCharCode = line[len - 1].charCodeAt(0);
  226. if (
  227. firstCharCode === 47 // 47 `/`
  228. // ends with
  229. || lastCharCode === 46 // 46 `.`, line.endsWith('.')
  230. || lastCharCode === 45 // 45 `-`, line.endsWith('-')
  231. || lastCharCode === 95 // 95 `_`, line.endsWith('_')
  232. // special modifier
  233. || R_KNOWN_NOT_NETWORK_FILTER_PATTERN_2.test(line)
  234. // || line.includes('$popup')
  235. // || line.includes('$removeparam')
  236. // || line.includes('$popunder')
  237. ) {
  238. return null;
  239. }
  240. if ((line.includes('/') || line.includes(':')) && !line.includes('://')) {
  241. return null;
  242. }
  243. const filter = NetworkFilter.parse(line);
  244. if (filter) {
  245. if (
  246. // filter.isCosmeticFilter() // always false
  247. // filter.isNetworkFilter() // always true
  248. filter.isElemHide()
  249. || filter.isGenericHide()
  250. || filter.isSpecificHide()
  251. || filter.isRedirect()
  252. || filter.isRedirectRule()
  253. || filter.hasDomains()
  254. || filter.isCSP() // must not be csp rule
  255. || (!filter.fromAny() && !filter.fromDocument())
  256. ) {
  257. // not supported type
  258. return null;
  259. }
  260. if (
  261. filter.hostname // filter.hasHostname() // must have
  262. && filter.isPlain() // isPlain() === !isRegex()
  263. && (!filter.isFullRegex())
  264. ) {
  265. const hostname = normalizeDomain(filter.hostname);
  266. if (!hostname) {
  267. return null;
  268. }
  269. // |: filter.isHostnameAnchor(),
  270. // |: filter.isLeftAnchor(),
  271. // |https://: !filter.isHostnameAnchor() && (filter.fromHttps() || filter.fromHttp())
  272. const isIncludeAllSubDomain = filter.isHostnameAnchor();
  273. if (filter.isException() || filter.isBadFilter()) {
  274. return [hostname, isIncludeAllSubDomain ? ParseType.WhiteIncludeSubdomain : ParseType.WhiteAbsolute];
  275. }
  276. const _1p = filter.firstParty();
  277. const _3p = filter.thirdParty();
  278. if (_1p) {
  279. if (_1p === _3p) {
  280. return [hostname, isIncludeAllSubDomain ? ParseType.BlackIncludeSubdomain : ParseType.BlackAbsolute];
  281. }
  282. return null;
  283. }
  284. if (_3p) {
  285. return null;
  286. }
  287. }
  288. }
  289. // After NetworkFilter.parse, it means the line can not be parsed by cliqz NetworkFilter
  290. // We now need to "salvage" the line as much as possible
  291. /*
  292. * From now on, we are mostly facing non-standard domain rules (some are regex like)
  293. * We first skip third-party and frame rules, as Surge / Clash can't handle them
  294. *
  295. * `.sharecounter.$third-party`
  296. * `.bbelements.com^$third-party`
  297. * `://o0e.ru^$third-party`
  298. * `.1.1.1.l80.js^$third-party`
  299. */
  300. if (line.includes('$third-party') || line.includes('$frame')) {
  301. return null;
  302. }
  303. /** @example line.endsWith('^') */
  304. const lineEndsWithCaret = lastCharCode === 94; // lastChar === '^';
  305. /** @example line.endsWith('^|') */
  306. const lineEndsWithCaretVerticalBar = (lastCharCode === 124 /** lastChar === '|' */) && line[len - 2] === '^';
  307. /** @example line.endsWith('^') || line.endsWith('^|') */
  308. const lineEndsWithCaretOrCaretVerticalBar = lineEndsWithCaret || lineEndsWithCaretVerticalBar;
  309. // whitelist (exception)
  310. if (
  311. firstCharCode === 64 // 64 `@`
  312. && line[1] === '@'
  313. ) {
  314. let whiteIncludeAllSubDomain = true;
  315. /**
  316. * Some "malformed" regex-based filters can not be parsed by NetworkFilter
  317. * "$genericblock`" is also not supported by NetworkFilter, see:
  318. * https://github.com/ghostery/adblocker/blob/62caf7786ba10ef03beffecd8cd4eec111bcd5ec/packages/adblocker/test/parsing.test.ts#L950
  319. *
  320. * `@@||cmechina.net^$genericblock`
  321. * `@@|ftp.bmp.ovh^|`
  322. * `@@|adsterra.com^|`
  323. * `@@.atlassian.net$document`
  324. * `@@||ad.alimama.com^$genericblock`
  325. */
  326. let sliceStart = 0;
  327. let sliceEnd: number | undefined;
  328. if (line[2] === '|') { // line.startsWith('@@|')
  329. sliceStart = 3;
  330. whiteIncludeAllSubDomain = false;
  331. if (line[3] === '|') { // line.startsWith('@@||')
  332. sliceStart = 4;
  333. whiteIncludeAllSubDomain = true;
  334. }
  335. } else if (line[2] === '.') { // line.startsWith('@@.')
  336. sliceStart = 3;
  337. whiteIncludeAllSubDomain = true;
  338. } else if (
  339. /**
  340. * line.startsWith('@@://')
  341. *
  342. * `@@://googleadservices.com^|`
  343. * `@@://www.googleadservices.com^|`
  344. */
  345. line[2] === ':' && line[3] === '/' && line[4] === '/'
  346. ) {
  347. whiteIncludeAllSubDomain = false;
  348. sliceStart = 5;
  349. }
  350. if (lineEndsWithCaretOrCaretVerticalBar) {
  351. sliceEnd = -2;
  352. } else if (line.endsWith('$genericblock')) {
  353. sliceEnd = -13;
  354. if (line[len - 14] === '^') { // line.endsWith('^$genericblock')
  355. sliceEnd = -14;
  356. }
  357. } else if (line.endsWith('$document')) {
  358. sliceEnd = -9;
  359. if (line[len - 10] === '^') { // line.endsWith('^$document')
  360. sliceEnd = -10;
  361. }
  362. }
  363. if (sliceStart !== 0 || sliceEnd !== undefined) {
  364. const sliced = line.slice(sliceStart, sliceEnd);
  365. const domain = normalizeDomain(sliced);
  366. if (domain) {
  367. return [domain, whiteIncludeAllSubDomain ? ParseType.WhiteIncludeSubdomain : ParseType.WhiteAbsolute];
  368. }
  369. return [
  370. `[parse-filter E0001] (white) invalid domain: ${JSON.stringify({
  371. line, sliced, sliceStart, sliceEnd
  372. })}`,
  373. ParseType.ErrorMessage
  374. ];
  375. }
  376. return [
  377. `[parse-filter E0006] (white) failed to parse: ${JSON.stringify({
  378. line, sliceStart, sliceEnd
  379. })}`,
  380. ParseType.ErrorMessage
  381. ];
  382. }
  383. if (
  384. // 124 `|`
  385. // line.startsWith('|')
  386. firstCharCode === 124
  387. && lineEndsWithCaretOrCaretVerticalBar
  388. ) {
  389. /**
  390. * Some malformed filters can not be parsed by NetworkFilter:
  391. *
  392. * `||smetrics.teambeachbody.com^.com^`
  393. * `||solutions.|pages.indigovision.com^`
  394. * `||vystar..0rg@client.iebetanialaargentina.edu.co^`
  395. * `app-uat.latrobehealth.com.au^predirect.snapdeal.com`
  396. */
  397. const includeAllSubDomain = line[1] === '|';
  398. const sliceStart = includeAllSubDomain ? 2 : 1;
  399. const sliceEnd = lineEndsWithCaret
  400. ? -1
  401. : (lineEndsWithCaretVerticalBar ? -2 : undefined);
  402. const sliced = line.slice(sliceStart, sliceEnd); // we already make sure line startsWith "|"
  403. const domain = normalizeDomain(sliced);
  404. if (domain) {
  405. return [domain, includeAllSubDomain ? ParseType.BlackIncludeSubdomain : ParseType.BlackAbsolute];
  406. }
  407. return [
  408. `[parse-filter E0002] (black) invalid domain: ${sliced}`,
  409. ParseType.ErrorMessage
  410. ];
  411. }
  412. const lineStartsWithSingleDot = firstCharCode === 46; // 46 `.`
  413. if (
  414. lineStartsWithSingleDot
  415. && lineEndsWithCaretOrCaretVerticalBar
  416. ) {
  417. /**
  418. * `.ay.delivery^`
  419. * `.m.bookben.com^`
  420. * `.wap.x4399.com^`
  421. */
  422. const sliced = line.slice(
  423. 1, // remove prefix dot
  424. lineEndsWithCaret // replaceAll('^', '')
  425. ? -1
  426. : (lineEndsWithCaretVerticalBar ? -2 : undefined) // replace('^|', '')
  427. );
  428. const suffix = gorhill.getPublicSuffix(sliced);
  429. if (!gorhill.suffixInPSL(suffix)) {
  430. // This exclude domain-like resource like `1.1.4.514.js`
  431. return null;
  432. }
  433. const domain = normalizeDomain(sliced);
  434. if (domain) {
  435. return [domain, ParseType.BlackIncludeSubdomain];
  436. }
  437. return [
  438. `[paparse-filter E0003] (black) invalid domain: ${sliced}`,
  439. ParseType.ErrorMessage
  440. ];
  441. }
  442. /**
  443. * `|http://x.o2.pl^`
  444. * `://mine.torrent.pw^`
  445. * `://say.ac^`
  446. */
  447. if (lineEndsWithCaretOrCaretVerticalBar) {
  448. let sliceStart = 0;
  449. let sliceEnd;
  450. if (lineEndsWithCaret) { // line.endsWith('^')
  451. sliceEnd = -1;
  452. } else if (lineEndsWithCaretVerticalBar) { // line.endsWith('^|')
  453. sliceEnd = -2;
  454. }
  455. if (line.startsWith('://')) {
  456. sliceStart = 3;
  457. } else if (line.startsWith('http://')) {
  458. sliceStart = 7;
  459. } else if (line.startsWith('https://')) {
  460. sliceStart = 8;
  461. } else if (line.startsWith('|http://')) {
  462. sliceStart = 8;
  463. } else if (line.startsWith('|https://')) {
  464. sliceStart = 9;
  465. }
  466. if (sliceStart !== 0 || sliceEnd !== undefined) {
  467. const sliced = line.slice(sliceStart, sliceEnd);
  468. const domain = normalizeDomain(sliced);
  469. if (domain) {
  470. return [domain, ParseType.BlackIncludeSubdomain];
  471. }
  472. return [
  473. `[parse-filter E0004] (black) invalid domain: ${JSON.stringify({
  474. line, sliced, sliceStart, sliceEnd
  475. })}`,
  476. ParseType.ErrorMessage
  477. ];
  478. }
  479. }
  480. /**
  481. * `_vmind.qqvideo.tc.qq.com^`
  482. * `arketing.indianadunes.com^`
  483. * `charlestownwyllie.oaklawnnonantum.com^`
  484. * `-telemetry.officeapps.live.com^`
  485. * `-tracker.biliapi.net`
  486. * `-logging.nextmedia.com`
  487. * `_social_tracking.js^`
  488. */
  489. if (
  490. firstCharCode !== 124 // 124 `|`
  491. && lastCharCode === 94 // 94 `^`
  492. ) {
  493. const _domain = line.slice(0, -1);
  494. const suffix = gorhill.getPublicSuffix(_domain);
  495. if (!suffix || !gorhill.suffixInPSL(suffix)) {
  496. // This exclude domain-like resource like `_social_tracking.js^`
  497. return null;
  498. }
  499. const domain = normalizeDomain(_domain);
  500. if (domain) {
  501. return [domain, ParseType.BlackAbsolute];
  502. }
  503. return [
  504. `[parse-filter E0005] (black) invalid domain: ${_domain}`,
  505. ParseType.ErrorMessage
  506. ];
  507. }
  508. // Possibly that entire rule is domain
  509. /**
  510. * lineStartsWithSingleDot:
  511. *
  512. * `.cookielaw.js`
  513. * `.content_tracking.js`
  514. * `.ads.css`
  515. *
  516. * else:
  517. *
  518. * `_prebid.js`
  519. * `t.yesware.com`
  520. * `ubmcmm.baidustatic.com`
  521. * `://www.smfg-card.$document`
  522. * `portal.librus.pl$$advertisement-module`
  523. * `@@-ds.metric.gstatic.com^|`
  524. * `://gom.ge/cookie.js`
  525. * `://accout-update-smba.jp.$document`
  526. * `_200x250.png`
  527. * `@@://www.liquidweb.com/kb/wp-content/themes/lw-kb-theme/images/ads/vps-sidebar.jpg`
  528. */
  529. let sliceStart = 0;
  530. let sliceEnd: number | undefined;
  531. if (lineStartsWithSingleDot) {
  532. sliceStart = 1;
  533. }
  534. if (line.endsWith('^$all')) { // This salvage line `thepiratebay3.com^$all`
  535. sliceEnd = -5;
  536. } else if (
  537. // Try to salvage line like `://account.smba.$document`
  538. // For this specific line, it will fail anyway though.
  539. line.endsWith('$document')
  540. ) {
  541. sliceEnd = -9;
  542. }
  543. const sliced = (sliceStart !== 0 || sliceEnd !== undefined) ? line.slice(sliceStart, sliceEnd) : line;
  544. const suffix = gorhill.getPublicSuffix(sliced);
  545. /**
  546. * Fast exclude definitely not domain-like resource
  547. *
  548. * `.gatracking.js`, suffix is `js`,
  549. * `.ads.css`, suffix is `css`,
  550. * `-cpm-ads.$badfilter`, suffix is `$badfilter`,
  551. * `portal.librus.pl$$advertisement-module`, suffix is `pl$$advertisement-module`
  552. */
  553. if (!suffix || !gorhill.suffixInPSL(suffix)) {
  554. // This exclude domain-like resource like `.gatracking.js`, `.beacon.min.js` and `.cookielaw.js`
  555. return null;
  556. }
  557. const tryNormalizeDomain = normalizeDomain(sliced);
  558. if (tryNormalizeDomain === sliced) {
  559. // the entire rule is domain
  560. return [sliced, ParseType.BlackIncludeSubdomain];
  561. }
  562. return [
  563. `[parse-filter E0010] can not parse: ${line}`,
  564. ParseType.ErrorMessage
  565. ];
  566. }