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

Function SSD2QX

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

Source from the content-addressed store, hash-verified

2030
2031//SSD 类型 URI 转换 quanx 格式
2032function SSD2QX(subs, Pudp, Ptfo) {
2033 var j = 0
2034 var QX = []
2035 var cnt = JSON.parse(Base64.decode(subs.split("ssd://")[1]))
2036 var type = "shadowsocks=";
2037 var pwd = "password=" + cnt.password;
2038 var mtd = "method=" + cnt.encryption;
2039 var obfs = ""
2040 var obfshost = ""
2041 var port = cnt.port ? ":" + cnt.port : ""
2042 if (cnt.plugin_options) {
2043 obfs = cnt.plugin_options.split(";")[0] != null ? ", " + cnt.plugin_options.split(";")[0] : "";
2044 obfshost = cnt.plugin_options.split(";")[1] != null ? ", " + cnt.plugin_options.split(";")[1] : "";
2045 }
2046 pudp = Pudp == 1 ? "udp-relay=true" : "udp-relay=false";
2047 ptfo = Ptfo == 1 ? "fast-open=true" : "fast-open=false";
2048 for (var i in cnt.servers) {
2049 ip = cnt.servers[i].server;
2050 if (cnt.servers[i].plugin_options) {
2051 obfs = cnt.servers[i].plugin_options.split(";")[0] != null ? ", " + cnt.servers[i].plugin_options.split(";")[0] : "";
2052 obfshost = cnt.servers[i].plugin_options.split(";")[1] != null ? ", " + cnt.servers[i].plugin_options.split(";")[1] : "";
2053 }
2054 if (cnt.servers[i].encryption) { //独立的加密方式
2055 mtd = "method=" + cnt.servers[i].encryption
2056 }
2057 if (cnt.servers[i].password) { //独立的密码
2058 pwd = "password=" + cnt.servers[i].password
2059 }
2060 if (ip.indexOf(".") > 0) { //排除难搞的 ipv6 节点
2061 port = cnt.servers[i].port ? ":" + cnt.servers[i].port : port;
2062 tag = "tag=" + cnt.servers[i].remarks;
2063 QX[j] = type + ip + port + ", " + pwd + ", " + mtd + obfs + obfshost + ", " + pudp + ", " + ptfo + ", " + tag;
2064 var j = j + 1;
2065 }
2066 }
2067 return QX;
2068}
2069
2070// 纠正部分不规范的写法(没有把 tag 写在最后)
2071function QXFix(cntf) {

Callers 1

Subs2QXFunction · 0.85

Calls 2

parseMethod · 0.45
indexOfMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…