♻️ refactor(core): 优化 iriscloud-rename 节点重命名规则
* 增强落地地区判定,新增对 JP 关键字的支持 * 引入 multiplierOf 逻辑,支持识别并保留节点倍率信息 * 扩展供应商识别列表,新增 SoftBank Home 和 iCable Home * 优化节点名称拼接结构,将倍率信息追加至名称末尾 * 同步更新 README 文档中的规则说明与示例输出
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* Iris Cloud 专用节点清理脚本
|
||||
* - Iris Cloud 名称里 HK 是入口/线路名的一部分,落地以尾部 SG、TYO、HKG 等标识为准
|
||||
* - 包含 SG 的节点归新加坡,包含 TYO 的节点归日本东京,其余默认香港
|
||||
* - 去掉 SZ/HZ/[Edge] 入口标签,保留 DMIT、DataCamp、iCable、SG.GS 等供应商特征
|
||||
* - 包含 SG 的节点归新加坡,包含 TYO/JP 的节点归日本,其余默认香港
|
||||
* - 去掉 SZ/HZ/[Edge] 入口标签,保留 DMIT、DataCamp、iCable、SoftBank、SG.GS 等供应商特征和倍率
|
||||
*/
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
const COMMON_SCRIPT_VERSION = '20260608-1';
|
||||
@@ -37,10 +37,14 @@ async function operator(proxies) {
|
||||
const landingPrefixOf = name => {
|
||||
if (/(?:^|[-\s])SG(?:$|[-\s.])/i.test(name)) return 'SG';
|
||||
if (/(?:^|[-\s])TYO(?:$|[-\s])/i.test(name)) return 'JP TYO';
|
||||
if (/(?:^|[-\s])JP(?:$|[-\s])/i.test(name)) return 'JP';
|
||||
if (/(?:^|[-\s])HK(?:$|[-\s])/i.test(name)) return 'HK';
|
||||
return 'HK';
|
||||
};
|
||||
|
||||
const providerOf = name => {
|
||||
if (/SoftBank\s+Home/i.test(name)) return 'SoftBank Home';
|
||||
if (/iCable\s+Home/i.test(name)) return 'iCable Home';
|
||||
if (/DataCamp/i.test(name)) return 'DataCamp';
|
||||
if (/iCable/i.test(name)) return 'iCable';
|
||||
if (/SG\.GS/i.test(name)) return 'SG.GS';
|
||||
@@ -48,6 +52,11 @@ async function operator(proxies) {
|
||||
return '';
|
||||
};
|
||||
|
||||
const multiplierOf = name => {
|
||||
const match = name.match(/\b(\d+(?:\.\d+)?)(?:\s*[xX]|倍)\b/i);
|
||||
return match ? `${match[1]}X` : '';
|
||||
};
|
||||
|
||||
const cleanCoreName = name => {
|
||||
const { text } = utils.splitLeadingOrInlineFlag(name);
|
||||
return text
|
||||
@@ -77,6 +86,7 @@ async function operator(proxies) {
|
||||
regionPrefix,
|
||||
regionCode,
|
||||
provider: providerOf(coreName),
|
||||
multiplier: multiplierOf(coreName),
|
||||
flag: utils.regionCodeToFlag(regionCode)
|
||||
};
|
||||
});
|
||||
@@ -108,7 +118,8 @@ async function operator(proxies) {
|
||||
item.flag,
|
||||
item.regionPrefix,
|
||||
String(regionCount[item.regionPrefix]).padStart(2, '0'),
|
||||
item.provider
|
||||
item.provider,
|
||||
item.multiplier
|
||||
].filter(Boolean).join(' ').trim();
|
||||
return item.proxy;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user