parse-filter.ts 19 KB

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