MCPcopy Create free account
hub / github.com/Moli-X/Resources / Clash2QX

Function Clash2QX

Script/Parser.js:2742–2781  ·  view source on GitHub ↗
(cnt)

Source from the content-addressed store, hash-verified

2740
2741// Clash parser
2742function Clash2QX(cnt) {
2743 const yaml = new YAML()
2744 if (Pdbg==1) { $notify(" Before YAML Parse", "content", cnt)}
2745 var aa = JSON.stringify(yaml.parse(YAMLFix(cnt))).replace(/yaml@bug𝟙/g,"[").replace(/冒号/gmi,":").replace(/yaml@bug𝟚/g,"*")
2746 for (var i=0;i<10;i++) {
2747 aa = aa.replace(new RegExp(patn[4][i], "gmi"),patn[0][i])
2748 }
2749 var bb = JSON.parse(aa).proxies
2750 if (Pdbg==1) { $notify("After YAML Parse", "content", JSON.stringify(bb))}
2751 //console.log(bb)
2752 var nl = bb.length
2753 var nodelist=[]
2754 var node=""
2755 for (i=0; i<nl; i++){
2756 try{
2757 node=bb[i]
2758 typecc = node.type
2759 if (typecc == "ss") {
2760 node = CSS2QX(node)
2761 } else if (typecc == "ssr"){
2762 node = CSSR2QX(node)
2763 } else if (typecc == "vmess"){
2764 node = CV2QX(node)
2765 } else if (typecc == "trojan"){
2766 node = CT2QX(node)
2767 } else if (typecc == "http"){
2768 node = CH2QX(node)
2769 } else if (typecc == "socks5"){
2770 node = CS52QX(node)
2771 }
2772 node = Pudp0 != 0 ? XUDP(node,Pudp0) : node
2773 node = Ptfo0 != 0 ? XTFO(node,Ptfo0) : node
2774 nodelist.push(node)
2775 }catch (e) {
2776 $notify(`⚠️该节点解析错误, 暂时已忽略处理`,`可点击通知并发送链接反馈至 bot`,JSON.stringify(node),bug_link )
2777 $notify(`⚠️错误内容如下`,`可复制错误内容到反馈 bot`,JSON.stringify(node)+"\n\n"+e)
2778 }
2779 }
2780 return nodelist.join("\n")
2781}
2782
2783//Clash ss type server
2784function CSS2QX(cnt) {

Callers 1

Type_CheckFunction · 0.85

Calls 14

YAMLFixFunction · 0.85
CSS2QXFunction · 0.85
CSSR2QXFunction · 0.85
CV2QXFunction · 0.85
CT2QXFunction · 0.85
CH2QXFunction · 0.85
CS52QXFunction · 0.85
XUDPFunction · 0.85
XTFOFunction · 0.85
$notifyFunction · 0.70
stringifyMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected