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

Function Surge2QX

Script/Parser.js:2473–2501  ·  view source on GitHub ↗
(conf)

Source from the content-addressed store, hash-verified

2471
2472//Surge2QX 转换主函数
2473function Surge2QX(conf) {
2474 var QXlist = conf.split("\n").map(isSurge).filter(Boolean)
2475 var Nlist = []
2476 var node=""
2477 for (var i = 0; i < QXlist.length; i++) {
2478 var cnt = QXlist[i];
2479 if (cnt.split("=")[1].split(",")[0].indexOf("trojan") != -1) {
2480 node = Strojan2QX(cnt)//surge 3的trojan
2481 } else if (cnt.split("=")[1].split(",")[0].indexOf("http") != -1) {
2482 node = Shttp2QX(cnt) //surge 3的http
2483 } else if (cnt.split("=")[1].split(",")[0].indexOf("vmess") != -1) {
2484 node = SVmess2QX(cnt) //surge 3的Vmess
2485 } else if (cnt.split("=")[1].split(",")[0].indexOf("ss") != -1) {
2486 node = SSS2QX(cnt) //surge 3的SS
2487 } else if (cnt.split("=")[1].split(",")[0].indexOf("socks5") != -1) {
2488 node = SS52QX(cnt) //surge 3的Socks5
2489 } else if (cnt.split("=")[1].split(",")[0].indexOf("custom") != -1) {
2490 node = SCT2QX(cnt) //surge2写法
2491 }
2492 node = Pudp0 != 0 ? XUDP(node,Pudp0) : node
2493 node = Ptfo0 != 0 ? XTFO(node,Ptfo0) : node
2494 if (cnt.indexOf("test-url") !=-1) {
2495 var checkurl = ", server_check_url" + cnt.split("test-url")[1].split(",")[0]
2496 node = node.replace(/\,(\s)*tag/, checkurl + ", tag")
2497 }
2498 Nlist.push(node)
2499 }
2500 return (Nlist)
2501}
2502
2503
2504// surge2 中的 SS 类型写法(custom)

Callers 2

Type_CheckFunction · 0.85
Subs2QXFunction · 0.85

Calls 10

Strojan2QXFunction · 0.85
Shttp2QXFunction · 0.85
SVmess2QXFunction · 0.85
SSS2QXFunction · 0.85
SS52QXFunction · 0.85
SCT2QXFunction · 0.85
XUDPFunction · 0.85
XTFOFunction · 0.85
indexOfMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected