mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-21 13:50:29 +08:00
201 lines
5.1 KiB
JavaScript
201 lines
5.1 KiB
JavaScript
'use strict';const fetchRetry=require('./chunks/fetch-retry.D06uBUaW.cjs'),require$$0=require('node:path'),fetchTextByLine=require('./chunks/fetch-text-by-line.YY5b5610.cjs'),trie=require('./chunks/trie.Vu1FNyv-.cjs'),require$$5=require('tldts-experimental'),looseTldtsOpt=require('./chunks/loose-tldts-opt.DLUpGXpj.cjs');require('picocolors'),require('undici'),require('undici-cache-store-better-sqlite3'),require('node:util'),require('node:fs'),require('node:process'),require('node:readline'),require('node:stream/web'),require('foxts/guard'),require('./chunks/misc.BpcQjda1.cjs'),require('node:fs/promises'),require('foxts/noop'),require('foxts/fast-string-array-join'),require('foxts/bitwise');var validateGlobalTld$1 = {};var domains = {};var hasRequiredDomains;
|
|
|
|
function requireDomains () {
|
|
if (hasRequiredDomains) return domains;
|
|
hasRequiredDomains = 1;
|
|
(function (exports) {
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
Object.defineProperty(exports, "ICP_TLD", {
|
|
enumerable: true,
|
|
get: function() {
|
|
return ICP_TLD;
|
|
}
|
|
});
|
|
const ICP_TLD = [
|
|
'ren',
|
|
'wang',
|
|
'citic',
|
|
'top',
|
|
'sohu',
|
|
'xin',
|
|
'com',
|
|
'net',
|
|
'club',
|
|
'xyz',
|
|
'site',
|
|
'shop',
|
|
'info',
|
|
'mobi',
|
|
'red',
|
|
'pro',
|
|
'kim',
|
|
'ltd',
|
|
'group',
|
|
'biz',
|
|
'link',
|
|
'store',
|
|
'tech',
|
|
'fun',
|
|
'online',
|
|
'art',
|
|
'design',
|
|
'love',
|
|
'center',
|
|
'video',
|
|
'social',
|
|
'team',
|
|
'show',
|
|
'cool',
|
|
'zone',
|
|
'world',
|
|
'today',
|
|
'city',
|
|
'chat',
|
|
'company',
|
|
'live',
|
|
'fund',
|
|
'gold',
|
|
'plus',
|
|
'guru',
|
|
'run',
|
|
'pub',
|
|
'email',
|
|
'life',
|
|
'co',
|
|
'baidu',
|
|
'cloud',
|
|
'host',
|
|
'space',
|
|
'press',
|
|
'website',
|
|
'archi',
|
|
'asia',
|
|
'bio',
|
|
'black',
|
|
'blue',
|
|
'green',
|
|
'lotto',
|
|
'organic',
|
|
'pet',
|
|
'pink',
|
|
'poker',
|
|
'promo',
|
|
'ski',
|
|
'vote',
|
|
'voto',
|
|
'icu',
|
|
'fans',
|
|
'unicom',
|
|
'jpmorgan',
|
|
'chase',
|
|
'cc',
|
|
'band',
|
|
'cab',
|
|
'cafe',
|
|
'cash',
|
|
'fan',
|
|
'fyi',
|
|
'games',
|
|
'market',
|
|
'mba',
|
|
'news',
|
|
'media',
|
|
'sale',
|
|
'shopping',
|
|
'studio',
|
|
'tax',
|
|
'technology',
|
|
'vin',
|
|
'baby',
|
|
'college',
|
|
'monster',
|
|
'protection',
|
|
'rent',
|
|
'security',
|
|
'storage',
|
|
'theatre',
|
|
'bond',
|
|
'cyou',
|
|
'uno',
|
|
'school',
|
|
'global',
|
|
'me',
|
|
'pw',
|
|
'hk',
|
|
'tv',
|
|
'saxo',
|
|
'click',
|
|
'auto',
|
|
'autos',
|
|
'beauty',
|
|
'boats',
|
|
'car',
|
|
'cars',
|
|
'hair',
|
|
'homes',
|
|
'makeup',
|
|
'motorcycles',
|
|
'quest',
|
|
'skin',
|
|
'tickets',
|
|
'yachts',
|
|
'kids'
|
|
];
|
|
} (domains));
|
|
return domains;
|
|
}var hasRequiredValidateGlobalTld;
|
|
|
|
function requireValidateGlobalTld () {
|
|
if (hasRequiredValidateGlobalTld) return validateGlobalTld$1;
|
|
hasRequiredValidateGlobalTld = 1;
|
|
Object.defineProperty(validateGlobalTld$1, "__esModule", {
|
|
value: true
|
|
});
|
|
const _nodepath = /*#__PURE__*/ _interop_require_default(require$$0);
|
|
const _fetchtextbyline = /*@__PURE__*/ fetchTextByLine.a();
|
|
const _trie = /*@__PURE__*/ trie.r();
|
|
const _dir = /*@__PURE__*/ fetchRetry.a();
|
|
const _domains = /*@__PURE__*/ requireDomains();
|
|
const _tldtsexperimental = /*#__PURE__*/ _interop_require_default(require$$5);
|
|
const _loosetldtsopt = /*@__PURE__*/ looseTldtsOpt.r();
|
|
function _interop_require_default(obj) {
|
|
return obj && obj.__esModule ? obj : {
|
|
default: obj
|
|
};
|
|
}
|
|
(async ()=>{
|
|
const trie = new _trie.HostnameSmolTrie();
|
|
const extraWhiteTLDs = new Set();
|
|
for await (const line of (0, _fetchtextbyline.readFileByLine)(_nodepath.default.join(_dir.OUTPUT_SURGE_DIR, 'non_ip', 'domestic.conf'))){
|
|
const [type, domain] = line.split(',');
|
|
if (type !== 'DOMAIN' && type !== 'DOMAIN-SUFFIX') {
|
|
continue;
|
|
}
|
|
if (domain === 'this_ruleset_is_made_by_sukkaw.ruleset.skk.moe') {
|
|
continue;
|
|
}
|
|
const tld = _tldtsexperimental.default.getPublicSuffix(domain, _loosetldtsopt.looseTldtsOpt);
|
|
if (tld) {
|
|
extraWhiteTLDs.add(tld);
|
|
}
|
|
}
|
|
for await (const line of (0, _fetchtextbyline.readFileByLine)(_nodepath.default.join(_dir.SOURCE_DIR, 'non_ip', 'global.conf'))){
|
|
const [type, domain] = line.split(',');
|
|
switch(type){
|
|
case 'DOMAIN':
|
|
trie.add(domain);
|
|
break;
|
|
case 'DOMAIN-SUFFIX':
|
|
trie.add(domain, true);
|
|
break;
|
|
}
|
|
}
|
|
_domains.ICP_TLD.forEach((tld)=>trie.whitelist(tld, true));
|
|
extraWhiteTLDs.forEach((tld)=>trie.whitelist(tld, true));
|
|
console.log(trie.dump().join('\n'));
|
|
})();
|
|
return validateGlobalTld$1;
|
|
}var validateGlobalTldExports = requireValidateGlobalTld();
|
|
const validateGlobalTld = /*@__PURE__*/fetchRetry.g(validateGlobalTldExports);module.exports=validateGlobalTld; |