MCPcopy Index your code
hub / github.com/Moli-X/Resources / SSR2QX

Function SSR2QX

Script/Parser.js:1903–1928  ·  view source on GitHub ↗
(subs, Pudp, Ptfo)

Source from the content-addressed store, hash-verified

1901//a.c.com:0031:origin:aes-256-gcm:plain:pwdpwd/?obfsparam=&remarks=xxxx
1902//SSR 类型 URI 转换 quanx 格式
1903function SSR2QX(subs, Pudp, Ptfo) {
1904 var nssr = []
1905 var cnt = Base64.decode(subs.split("ssr://")[1].replace(/-/g, "+").replace(/_/g, "/")).split("\u0000")[0]
1906 var obfshost = '';
1907 var oparam = '';
1908 if (cnt.split(":").length <= 8) { //排除难搞的 ipv6 节点
1909 type = "shadowsocks=";
1910 ip = cnt.split(":")[0] + ":" + cnt.split(":")[1];
1911 pwd = "password=" + Base64.decode(cnt.split("/?")[0].split(":")[5].replace(/-/g, "+").replace(/_/g, "/")).split("\u0000")[0];
1912 mtd = "method=" + cnt.split(":")[3];
1913 obfs =cnt.split(":")[4]!= "plain"? "obfs=" + cnt.split(":")[4] : ""; //plain?
1914 ssrp = cnt.split(":")[2] != "origin"? "ssr-protocol=" + cnt.split(":")[2] : ""; //origin?
1915 if (cnt.indexOf("obfsparam=") != -1 && obfs != "") {
1916 obfshost = cnt.split("obfsparam=")[1].split("&")[0] != "" ? "obfs-host=" + Base64.decode(cnt.split("obfsparam=")[1].split("&")[0].replace(/-/g, "+").replace(/_/g, "/")).split(",")[0].split("\u0000")[0] : ""
1917 }
1918 if (cnt.indexOf("protoparam=") != -1) {
1919 oparam = cnt.split("protoparam=")[1].split("&")[0] != "" ? "ssr-protocol-param=" + Base64.decode(cnt.split("protoparam=")[1].split("&")[0].replace(/-/g, "+").replace(/_/g, "/")).split(",")[0].split("\u0000")[0] : ""
1920 }
1921 tag = "tag=" + (Base64.decode(cnt.split("remarks=")[1].split("&")[0].replace(/-/g, "+").replace(/_/g, "/"))).split("\u0000")[0]
1922 pudp = Pudp == 1 ? "udp-relay=true" : "udp-relay=false";
1923 ptfo = Ptfo == 1 ? "fast-open=true" : "fast-open=false";
1924 nssr.push(type + ip, pwd, mtd, obfs , obfshost, oparam, ssrp, pudp, ptfo, tag)
1925 QX = nssr.filter(Boolean).join(", ")
1926 } else { QX = "" }
1927 return QX;
1928}
1929
1930//Trojan 类型 URI 转换成 QX, 包含小火箭类型
1931function TJ2QX(subs, Pudp, Ptfo, Pcert0, PTls13) {

Callers 1

Subs2QXFunction · 0.85

Calls 3

indexOfMethod · 0.45
pushMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…