cfpilot 0.13.9 → 0.13.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/control.js +1 -1
- package/assets/dataplane.js +1 -1
- package/assets/worker.js +1 -1
- package/dist/cli.js +96 -17
- package/package.json +1 -1
package/assets/control.js
CHANGED
|
@@ -3,7 +3,7 @@ const __sfx=(()=>{const __t=new TextDecoder(),__c=new Map();return b=>{let v=__c
|
|
|
3
3
|
`))),a){let k=""+P+__sfx("IFRyb2phbg==");r.push(k),n.push([__sfx("ICAtIG5hbWU6IA==")+B(k)+"",__sfx("ICAgIHR5cGU6IHRyb2phbg=="),__sfx("ICAgIHBhc3N3b3JkOiA=")+B(t.config.trojanPassword)+"",__sfx("ICAgIHNlcnZlcjog")+d.ip+"",__sfx("ICAgIHBvcnQ6IA==")+U+"",__sfx("ICAgIG5ldHdvcms6IHdz"),__sfx("ICAgIHRsczogdHJ1ZQ=="),__sfx("ICAgIHNuaTog")+t.domain+"",__sfx("ICAgIGNsaWVudC1maW5nZXJwcmludDog")+t.config.clientFingerprint+"",...l()," ws-opts:",__sfx("ICAgICAgcGF0aDog")+B(t.config.trojanPath)+""," headers:",` Host: ${t.domain}`].join(`
|
|
4
4
|
`))}}});e.push(__sfx("IyBDRlBpbG90IOiHquWKqOeUn+aIkOiuoumYhQ==")),e.push(__sfx("bWl4ZWQtcG9ydDogNzg5MA==")),e.push(__sfx("YWxsb3ctbGFuOiBmYWxzZQ==")),e.push(__sfx("bW9kZTogcnVsZQ==")),e.push(__sfx("bG9nLWxldmVsOiBpbmZv")),e.push(__sfx("dW5pZmllZC1kZWxheTogdHJ1ZQ==")),e.push(__sfx("dGNwLWNvbmN1cnJlbnQ6IHRydWU=")),e.push(""),e.push("dns:"),e.push(__sfx("ICBlbmFibGU6IHRydWU=")),e.push(__sfx("ICBpcHY2OiBmYWxzZQ==")),e.push(__sfx("ICBlbmhhbmNlZC1tb2RlOiBmYWtlLWlw")),e.push(__sfx("ICBmYWtlLWlwLXJhbmdlOiAxOTguMTguMC4xLzE2")),e.push(" default-nameserver:"),e.push(" - 223.5.5.5"),e.push(" - 119.29.29.29"),e.push(" nameserver:"),e.push(" - https://223.5.5.5/dns-query"),e.push(" - https://dns.alidns.com/dns-query"),e.push(" fallback:"),e.push(" - 8.8.4.4"),e.push(" - 1.1.1.1"),e.push(" fallback-filter:"),e.push(__sfx("ICAgIGdlb2lwOiB0cnVl")),e.push(__sfx("ICAgIGdlb2lwLWNvZGU6IENO")),e.push(""),i&&(e.push(" nameserver-policy:"),e.push(` ${B(c)}: ${p?B(p):"https://223.5.5.5/dns-query"}`),e.push(""));let u=He(t.routeProfile??"",{mainGroup:__sfx("Q0ZQaWxvdA=="),autoGroup:__sfx("6Ieq5Yqo6YCJ5oup")});if(e.push("proxies:"),n.length===0?e.push(" []"):e.push(...n),e.push(""),e.push(__sfx("cHJveHktZ3JvdXBzOg==")),e.push(__sfx("ICAtIG5hbWU6ICJDRlBpbG90Ig==")),e.push(__sfx("ICAgIHR5cGU6IHNlbGVjdA==")),e.push(" proxies:"),e.push(__sfx("ICAgICAgLSAi6Ieq5Yqo6YCJ5oupIg==")),e.push(__sfx("ICAgICAgLSAi5pWF6Zqc6L2s56e7Ig==")),r.length===0)e.push(" []");else for(let f of r)e.push(` - ${B(f)}`);if(r.length>0){e.push(""),e.push(__sfx("ICAtIG5hbWU6ICLoh6rliqjpgInmi6ki")),e.push(__sfx("ICAgIHR5cGU6IHVybC10ZXN0")),e.push(__sfx("ICAgIHVybDogImh0dHA6Ly93d3cuZ3N0YXRpYy5jb20vZ2VuZXJhdGVfMjA0Ig==")),e.push(__sfx("ICAgIGludGVydmFsOiAzMDA=")),e.push(__sfx("ICAgIHRvbGVyYW5jZTogNTA=")),e.push(" proxies:");for(let f of r)e.push(` - ${B(f)}`);e.push(""),e.push(__sfx("ICAtIG5hbWU6ICLmlYXpmpzovaznp7si")),e.push(__sfx("ICAgIHR5cGU6IGZhbGxiYWNr")),e.push(__sfx("ICAgIHVybDogImh0dHA6Ly93d3cuZ3N0YXRpYy5jb20vZ2VuZXJhdGVfMjA0Ig==")),e.push(__sfx("ICAgIGludGVydmFsOiAzMDA=")),e.push(" proxies:");for(let f of r)e.push(` - ${B(f)}`)}return u.groups.length>0&&(e.push(""),e.push(...u.groups)),e.push(""),e.push("rules:"),u.rules.length>0?(e.push(...u.rules),u.rules.some(f=>f.includes("MATCH,"))||e.push(__sfx("ICAtIE1BVENILENGUGlsb3Q="))):e.push(...Me(__sfx("Q0ZQaWxvdA=="))),e.push(""),e.join(`
|
|
5
5
|
`)}function Br(t){let e=[],n=[],r=Zt(t.config.subVariants,t.config,Ve),o=r.some(l=>l===__sfx("dmxlc3Mtd3M=")),s=r.includes(__sfx("dHJvamFu")),a=t.config.ech,i=t.config.echHost.trim()||__sfx("Y2xvdWRmbGFyZS1lY2guY29t"),c=()=>a?{ech:{enabled:!0,query_server_name:i}}:{};for(let l of Qt(t)){let u=[];l.entries.forEach((f,d)=>{let g=`${l.name} ${ht(f,"vless",d,"")}`;for(let h of Jt(f,t)){let U=t.ports.length>1?`:${h}`:"",D=`${g}${U}`,P=""+D+__sfx("IFRyb2phbg==");o&&u.push(D),s&&u.push(P),o&&e.push({type:__sfx("dmxlc3M="),tag:D,server:f.ip,server_port:h,uuid:t.config.uuid,tls:{enabled:!0,server_name:t.domain,insecure:!1,utls:{enabled:!0,fingerprint:t.config.clientFingerprint},...c()},transport:{type:"ws",path:t.config.wsPath,headers:{Host:t.domain}}}),s&&e.push({type:__sfx("dHJvamFu"),tag:P,server:f.ip,server_port:h,password:t.config.trojanPassword,tls:{enabled:!0,server_name:t.domain,insecure:!1,utls:{enabled:!0,fingerprint:t.config.clientFingerprint},...c()},transport:{type:"ws",path:t.config.trojanPath,headers:{Host:t.domain}}})}}),u.length>0&&n.push({tag:l.name,members:u})}e.push({type:"direct",tag:"direct"});for(let l of n)e.push({type:"selector",tag:l.tag,outbounds:l.members,default:l.members[0]});return e.push({type:"selector",tag:__sfx("Q0ZQaWxvdA=="),outbounds:n.length>0?n.map(l=>l.tag):["direct"],default:n.length>0?n[0].tag:"direct"}),JSON.stringify({log:{level:"info",timestamp:!0},dns:{servers:[{tag:"dns-out",address:"https://1.1.1.1/dns-query"},{tag:"local",address:"local"}],rules:[{domain_suffix:Qe,server:"local"}]},inbounds:[{type:"mixed",tag:"mixed-in",listen:__sfx("MTI3LjAuMC4x"),listen_port:2080}],outbounds:e,route:{rules:[{ip_is_private:!0,outbound:"direct"},{domain_suffix:Qe,outbound:"direct"}],final:__sfx("Q0ZQaWxvdA=="),auto_detect_interface:!0}},null,2)}function Fr(t){let e=[],n=Zt(t.config.subVariants,t.config);for(let r of Qt(t))r.entries.forEach((o,s)=>{let a=ht(o,__sfx("dmxlc3M="),s,r.name);for(let i of Jt(o,t)){let c=t.ports.length>1?`:${i}`:"",p=`${a}${c}`,l={...o,port:i};for(let u of n)u===__sfx("dmxlc3Mtd3M=")?e.push(Ze(l,t,"ws",`${p} WS`)):u===__sfx("dmxlc3MteGh0dHA=")?e.push(Ze(l,t,__sfx("eGh0dHA="),""+p+__sfx("IFhIVFRQ"))):e.push(Mr(l,t,""+p+__sfx("IFRyb2phbg==")))}});return Ce(e.join(`
|
|
6
|
-
`))}function en(t,e){let n=Vt(e.config.subName);switch(t){case __sfx("Y2xhc2g="):return{body:Hr(e),contentType:"text/yaml; charset=utf-8",fileName:n};case"singbox":return{body:Br(e),contentType:"application/json; charset=utf-8",fileName:n};default:return{body:Fr(e),contentType:"text/plain; charset=utf-8",fileName:n}}}var $,mr,gr,Fe,je,Ge,hr,br,yr,Ir,kr,Or,_,Lr,We,Ve,vr,Qe,qt=I(()=>{"use strict";De();K();zt();Be();$=443;mr=[__sfx("aXDlnLDlnYA="),__sfx("aXAg5Zyw5Z2A"),"ip",__sfx("5Zyw5Z2A"),__sfx("5pyN5Yqh5Zmo"),"server","host"],gr=[__sfx("56uv5Y+j"),"port"],Fe=[__sfx("5LiL6L296YCf5bqm"),__sfx("6YCf5bqm"),"speed","download"],je=[__sfx("5bmz5Z2H5bu26L+f"),__sfx("5bu26L+f"),"latency","delay",__sfx("5ZON5bqU5pe26Ze0"),"rtt"],Ge=["colo",__sfx("5py65oi/"),__sfx("5pWw5o2u5Lit5b+D"),__sfx("5Zyw5Yy6"),"region"],hr=[__sfx("5Zu95a62"),"country",__sfx("5Zu95Yir")],br=[__sfx("5Z+O5biC"),"city"],yr=["tls",__sfx("5piv5ZCm5pSv5oyBdGxz"),__sfx("5pSv5oyBdGxz")];Ir={official:__sfx("5a6Y5pa55LyY6YCJSVA="),domain:__sfx("5LyY6YCJ5Z+f5ZCN"),manual:__sfx("5omL5Yqo5LyY6YCJSVA="),api:__sfx("6L+c56iLQVBJ"),csv:__sfx("5rWL6YCfQ1NW")};kr=12e4,Or=32,_=new Map,Lr="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36";We=[__sfx("dmxlc3Mtd3M="),__sfx("dmxlc3MteGh0dHA="),__sfx("dHJvamFu")];Ve=[__sfx("dmxlc3Mtd3M="),__sfx("dHJvamFu")];vr=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;Qe=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});function Zr(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function un(t,e){let n=await crypto.subtle.importKey("raw",an.encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",n,an.encode(e));return Zr(new Uint8Array(r))}async function Nt(t){let e=(await t.get(Tt))?.trim();if(e)return e;let n=ln();return t instanceof X&&await t.put(Tt,n),n}async function cn(t){let e=ln();return t instanceof X?await t.put(Tt,e):await t.put(Tt,e),e}async function fn(t,e={}){let n=e.ttlDays??0,r=Math.floor((e.now??Date.now())/1e3),o=n>0?r+Math.round(n*86400):0,s=Math.floor(Math.random()*36**8).toString(36).padStart(8,"0"),a=`${te}.${o.toString(36)}.${s}`,i=(await un(t,a)).slice(0,ee);return`${a}.${i}`}async function It(t,e,n=Date.now()){if(!t||!e)return{ok:!1,reason:"format"};let r=e.split(".");if(r.length!==4||r[0]!==te)return{ok:!1,reason:"format"};let o=r[1],s=r[2],a=r[3];if(!o||!s||a.length!==ee)return{ok:!1,reason:"format"};let i=Number.parseInt(o,36);if(!Number.isFinite(i)||i<0)return{ok:!1,reason:"format"};let c=(await un(t,`${te}.${o}.${s}`)).slice(0,ee);return Y(a,c)?i>0&&Math.floor(n/1e3)>=i?{ok:!1,reason:"expired",exp:i}:{ok:!0,exp:i}:{ok:!1,reason:"signature"}}var Tt,te,ee,an,ln,ne=I(()=>{"use strict";yt();K();Tt="SUB_TOKEN_SECRET",te="v1",ee=22,an=new TextEncoder;ln=()=>L(32)});function Jr(t){let e="";for(let n of t)e+=(n<16?"0":"")+n.toString(16);return e}function qr(t){if(!/^[0-9a-f]*$/.test(t)||t.length%2!==0)return null;let e=new Uint8Array(new ArrayBuffer(t.length/2));for(let n=0;n<e.length;n++)e[n]=Number.parseInt(t.slice(n*2,n*2+2),16);return e}async function yn(t,e,n){let r=qr(e);if(!r)return null;let o=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),"PBKDF2",!1,["deriveBits"]),s=await crypto.subtle.deriveBits({name:"PBKDF2",salt:r,iterations:n,hash:"SHA-256"},o,256);return Jr(new Uint8Array(s))}function wn(t){if(t.startsWith(`${oe}$`)){let[r,o,s,a]=t.split("$");if(r!==oe||!s||!a)return null;let i=Number.parseInt(o??"",10);return!Number.isFinite(i)||i<1||i>1e6?null:{scheme:"pbkdf2",salt:s,iterations:i,expected:a}}let[e,n]=t.split(":");return!e||!n?null:{scheme:"sha256",salt:e,iterations:0,expected:n}}async function Pn(t,e){return t.scheme==="pbkdf2"?await yn(e,t.salt,t.iterations):await Ht(`${t.salt}:${e}`)}async function se(t,e){let n=await yn(t,e,gn);return n?`${oe}$${gn}$${e}$${n}`:`${e}:${await Ht(`${e}:${t}`)}`}async function _r(t,e){let n=wn(t);if(!n)return!1;let r=await Pn(n,e);return r?Y(r,n.expected):!1}function hn(t){return`/${t.trim().replace(/^\/+/,"")}`}async function Cn(t,e,n){let r=await t.get(Ct)??"",o=n&&n.trim()?hn(n):"";o?r!==o&&(r=o,await t.put(Ct,r)):r||(r=hn(`${Re}-${Pe(6)}`),await t.put(Ct,r));let s=await t.get(it)??"",a=null,i=e&&e.trim()?e.trim():"";if(i){if(!s||!await _r(s,i)){let p=L(8);s=await se(i,p),await t.put(it,s)}await t.get(nt)&&await t.delete(nt)}else if(!s){let c=`cfp-${L(8)}`,p=L(8);s=await se(c,p),await t.put(it,s),a=c,await t.put(nt,c)}return{panelPath:r,passwordHash:s,generatedPassword:a}}async function Sn(t,e){let n=wn(t.passwordHash);if(!n)return{ok:!1,legacy:!1};let r=await Pn(n,e);if(!r)return{ok:!1,legacy:!1};let o=Y(r,n.expected);return{ok:o,legacy:o&&n.scheme==="sha256"}}async function An(t,e){let n=L(8);await t.put(it,await se(e,n))}async function En(t){await t.get(nt)&&await t.delete(nt)}function Rn(t){let e=t.headers.get("Cookie")??"",n={};for(let r of e.split(";")){let o=r.indexOf("=");if(o<0)continue;let s=r.slice(0,o).trim(),a=r.slice(o+1).trim();s&&(n[s]=decodeURIComponent(a))}return n}async function xn(t){let e=L(24);return await t.put(`${Pt}${e}`,JSON.stringify({ua:"",t:Date.now()}),bn),e}async function ie(t,e){let n=Rn(e)[kt];return n?!!await t.get(`${Pt}${n}`):!1}function Tn(t,e=bn){return`${kt}=${t}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=${e}`}function Nn(){return`${kt}=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=0`}async function In(t,e){let n=Rn(e)[kt];n&&await t.delete(`${Pt}${n}`)}async function Dn(t){let e=L(20);return await t.put(`${wt}${e}`,"1",Vr),e}async function kn(t,e){if(!e)return!1;let n=await t.get("SCANNER_TOKEN");return n&&Y(n,e)?!0:await t.get(`${wt}${e}`)?(await t.delete(`${wt}${e}`),!0):!1}var kt,bn,Vr,gn,oe,ae=I(()=>{"use strict";ft();K();kt=__sfx("Y2ZwaWxvdF9zZXNz"),bn=3600*24,Vr=600,gn=3e4,oe="pbkdf2"});function On(t){return Se(t)}async function ue(t,e){if(v.config&&Date.now()-v.configAt<$r)return v.config;let n=await Ne(t,e);return v.config=n,v.configAt=Date.now(),n}function Ln(){v.config=null,v.configAt=0}async function le(t,e){if(v.auth&&Date.now()-v.authAt<to)return v.auth;let n=await Cn(t,e.PANEL_PASSWORD,e.PANEL_PATH);return v.auth=n,v.authAt=Date.now(),n}function ce(t){switch((t??"").toLowerCase()){case __sfx("Y2xhc2g="):case"mihomo":case"yaml":return __sfx("Y2xhc2g=");case"singbox":case"sing-box":case"json":return"singbox";case"v2ray":return"v2ray";case"base64":return"base64";default:return"base64"}}function bt(t){let e=String(t??"").trim();if(!e)return e;e=e.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,""),e=e.replace(/[/?#].*$/,"");let n=e.lastIndexOf("@");if(n>=0&&(e=e.slice(n+1)),e.startsWith("[")){let r=e.indexOf("]");r>0&&(e=e.slice(1,r))}else{let r=e.indexOf(":");r>=0&&e.indexOf(":",r+1)<0&&(e=e.slice(0,r))}return e.trim()}function vn(t){let e=(t??"").toLowerCase();return e?e.includes(__sfx("Y2xhc2g="))||e.includes("mihomo")||e.includes(__sfx("ZmxjbGFzaA=="))||e.includes(__sfx("Y2xhc2h4"))||e.includes("stash")?__sfx("Y2xhc2g="):e.includes("sing-box")||e.includes("singbox")?"singbox":e.includes("v2ray")||e.includes("v2rayng")||e.includes("shadowrocket")||e.includes("nekobox")||e.includes("surge")||e.includes("loon")||e.includes("quantumult")?"base64":null:null}var $r,to,v,Ot=I(()=>{"use strict";yt();ft();ae();$r=15e3,to=6e4,v={config:null,configAt:0,auth:null,authAt:0}});function fe(t,e,n){if(!t){n.push({field:e,message:""+e+__sfx("IOS4jeiDveS4uuepug==")});return}if(!t.startsWith("/")){n.push({field:e,message:""+e+__sfx("IOW/hemhu+S7pSAvIOW8gOWktA==")});return}if(t.length>128){n.push({field:e,message:""+e+__sfx("IOi/h+mVv++8iOacgOWkmiAxMjgg5a2X56ym77yJ")});return}/[\s\u0000-\u001f]/.test(t)&&n.push({field:e,message:""+e+__sfx("IOS4jeiDveWMheWQq+epuuagvOaIluaOp+WItuWtl+espg==")})}function tt(t,e,n,r,o){if(!Number.isFinite(t)){o.push({field:e,message:""+e+__sfx("IOW/hemhu+aYr+aVsOWtlw==")});return}(t<n||t>r)&&o.push({field:e,message:""+e+__sfx("IOW/hemhu+WcqCA=")+n+" ~ "+r+__sfx("IOS5i+mXtO+8iOW9k+WJjSA=")+t+")"})}function Lt(t,e,n){let r=t.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>20){n.push({field:e,message:""+e+__sfx("IOacgOWkmiAyMCDmnaHvvIjlvZPliY0g")+r.length+")"});return}for(let o of r)if(!no.test(o)){n.push({field:e,message:""+e+__sfx("IOmHjOacieaXoOazleivhuWIq+eahOadoeebru+8mg==")+o.slice(0,40)+""});return}}function Un(t,e,n){let r=t.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>10){n.push({field:e,message:""+e+__sfx("IOacgOWkmiAxMCDmnaHvvIjlvZPliY0g")+r.length+")"});return}for(let o of r)if(!/^https?:\/\/\S+$/i.test(o)){n.push({field:e,message:""+e+__sfx("IOW/hemhu+aYryBodHRwKHMpIOWcsOWdgO+8mg==")+o.slice(0,40)+""});return}}function pe(t){let e=[],n=o=>Object.prototype.hasOwnProperty.call(t,o);n("wsPath")&&fe(String(t.wsPath??""),"wsPath",e),n(__sfx("dHJvamFuUGF0aA=="))&&fe(String(t.trojanPath??""),__sfx("dHJvamFuUGF0aA=="),e),n(__sfx("eGh0dHBQYXRo"))&&fe(String(t.xhttpPath??""),__sfx("eGh0dHBQYXRo"),e);let r=["wsPath",__sfx("dHJvamFuUGF0aA=="),__sfx("eGh0dHBQYXRo")].filter(o=>n(o)).map(o=>`${o}=${String(t[o]??"")}`);if(r.length>=2){let o=r.map(s=>s.slice(s.indexOf("=")+1));new Set(o).size!==o.length&&e.push({field:"paths",message:__sfx("d3NQYXRoIC8gdHJvamFuUGF0aCAvIHhodHRwUGF0aCDkuI3og73ph43lpI0=")})}if(n("subDomain")){let o=String(t.subDomain??"").trim();o&&(!eo.test(o)||o.includes("/"))&&e.push({field:"subDomain",message:__sfx("c3ViRG9tYWluIOW/hemhu+aYr+WQiOazleS4u+acuuWQje+8iOS4jeWQq+WNj+iuruS4jui3r+W+hO+8iQ==")})}if(n(__sfx("cHJveHlJcA=="))&&Lt(String(t.proxyIp??""),__sfx("cHJveHlJcA=="),e),n(__sfx("c29ja3M1"))&&Lt(String(t.socks5??""),__sfx("c29ja3M1"),e),n("httpProxy")&&Lt(String(t.httpProxy??""),"httpProxy",e),n("relayPool")&&Lt(String(t.relayPool??""),"relayPool",e),n("officialCount")&&tt(Number(t.officialCount),"officialCount",1,200,e),n("domainCount")&&tt(Number(t.domainCount),"domainCount",1,200,e),n("maxNodes")&&tt(Number(t.maxNodes),"maxNodes",0,500,e),n("dls")&&tt(Number(t.dls),"dls",0,1e3,e),n("maxLatency")&&tt(Number(t.maxLatency),"maxLatency",0,1e4,e),n("dataBudgetMB")&&tt(Number(t.dataBudgetMB),"dataBudgetMB",0,102400,e),n("subTokenTtlDays")&&tt(Number(t.subTokenTtlDays),"subTokenTtlDays",0,3650,e),n("subPorts")){let o=String(t.subPorts??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>6?e.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg5pyA5aSaIDYg5Liq56uv5Y+j")}):s.every(a=>/^\d{1,5}$/.test(a)&&Number(a)>=1&&Number(a)<=65535)||e.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg6YeM5q+P5Liq56uv5Y+j6YO95b+F6aG75pivIDF+NjU1MzUg55qE5pWw5a2X")})}}if(n("subName")){let o=String(t.subName??"");o.length>40&&e.push({field:"subName",message:__sfx("c3ViTmFtZSDmnIDlpJogNDAg5a2X56ym")}),/[\u0000-\u001f]/.test(o)&&e.push({field:"subName",message:__sfx("c3ViTmFtZSDkuI3og73ljIXlkKvmjqfliLblrZfnrKY=")})}if(n("addApi")&&Un(String(t.addApi??""),"addApi",e),n("addCsv")&&Un(String(t.addCsv??""),"addCsv",e),n("uuid")){let o=String(t.uuid??"").trim();o&&!/^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$/.test(o)&&e.push({field:"uuid",message:__sfx("dXVpZCDlv4XpobvmmK/moIflh4YgVVVJRO+8iDM2IOS9je+8jOWPr+W4pui/nuWtl+espu+8iQ==")})}if(n("poolCountries")){let o=String(t.poolCountries??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>30?e.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDmnIDlpJogMzAg5Liq5Zu95a62L+WcsOWMug==")}):s.every(a=>/^[A-Za-z]{2,3}$/.test(a))||e.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDlj6rog73mmK8gMn4zIOS9jeWtl+avjeS7o+eggQ==")})}}if(n("udpDnsEndpoint")){let o=String(t.udpDnsEndpoint??"").trim();o&&!/^https:\/\/\S+$/i.test(o)&&e.push({field:"udpDnsEndpoint",message:__sfx("dWRwRG5zRW5kcG9pbnQg5b+F6aG75pivIGh0dHBzIOWcsOWdgA==")})}return e}function de(t){return t.length===0?"":t.length===1?t[0].message:"有 "+t.length+__sfx("IOmhuemFjee9ruS4jeWQiOazle+8mg==")+t.map(e=>e.message).join("\uFF1B")+""}var eo,no,Mn=I(()=>{"use strict";eo=/^(?=.{1,253}$)([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)(\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,no=/^(?:(?:socks5|socks|socks5h|http|https):\/\/)?(?:[^\s@/]+@)?(?:\[[0-9a-fA-F:]+\]|[A-Za-z0-9._-]+)(?::\d{1,5})?$/});function Fn(t,e=Date.now()){let n={};for(let o of Bn){let s=t[o];s!==void 0&&(n[o]=s)}let r=ro.map(o=>({field:o.field,reason:o.reason}));for(let o of[__sfx("c29ja3M1"),"httpProxy"]){let s=String(t[o]??"");if(!s){n[o]="";continue}if(s.includes("@")){r.push({field:o,reason:__sfx("5ZCr55So5oi35ZCNL+WPo+S7pO+8jOmcgOaJi+W3pemHjeaWsOWhq+WGmQ==")});continue}n[o]=s}return{schemaVersion:1,exportedAt:new Date(e).toISOString(),config:n,omitted:r}}function jn(t){let e=new Set([...Bn.map(String),__sfx("c29ja3M1"),"httpProxy"]),n={};for(let[r,o]of Object.entries(t))e.has(r)&&(n[r]=o);return n}function Hn(t){if(t==null)return"\uFF08\u7A7A\uFF09";if(typeof t=="string"){let e=t.replace(/\s+/g," ").trim();return e.length>60?`${e.slice(0,60)}\u2026`:e||"\uFF08\u7A7A\uFF09"}return String(t)}function Gn(t,e){let n=[];for(let[r,o]of Object.entries(e)){let s=t[r];String(s)!==String(o)&&n.push({field:r,from:Hn(s),to:Hn(o)})}return n}var Bn,ro,Yn=I(()=>{"use strict";Bn=["poolOfficial","officialCount","poolDomain","domainCount","poolManual","poolCountries","add","dls","maxLatency","maxNodes",__sfx("cHJveHlJcA=="),"relayPool","useBuiltinRelay","proxyMode","nat64","concurrentDial","dataBudgetMB","resolvePreferred",__sfx("ZW5hYmxlVHJvamFu"),__sfx("ZW5hYmxlWGh0dHA="),"subProtocol","subTransport","subVariants","subName","subPorts","clientFingerprint","ech","echHost","echDns","tlsFragment","tlsFragmentSize","tlsFragmentDelay","subToken","subTokenTtlDays","unlockProbe","udpDns","udpDnsEndpoint"],ro=[{field:"uuid",reason:__sfx("5YWl56uZ5Yet5o2u")},{field:__sfx("dHJvamFuUGFzc3dvcmQ="),reason:__sfx("5YWl56uZ5Yet5o2u")},{field:"wsPath",reason:__sfx("5a6e5L6L5qCH6K+G77yI6K6i6ZiF6ZO+5o6l6YeM5Y+v6KeB77yM5a+85Ye65Y2z5pq06Zyy5YWl5Y+j77yJ")},{field:__sfx("dHJvamFuUGF0aA=="),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:__sfx("eGh0dHBQYXRo"),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"subDomain",reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"addApi",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")},{field:"addCsv",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")}]});function Kn(){return new Response(JSON.stringify({build:me,version:ge,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var me,ge,zn,he=I(()=>{"use strict";me="00082f0-6a8a5b51",ge=__sfx("MC4xMy45"),zn=__sfx("L19fY2ZwX3ZlcnNpb24=")});var Zn={};tr(Zn,{API_PREFIX:()=>be,getScannerToken:()=>uo,handleApi:()=>lo});function so(t){return t.headers.get("CF-Connecting-IP")??t.headers.get("x-forwarded-for")?.split(",")[0]?.trim()??"unknown"}function io(t,e){let n=G.get(t);return n?e>=n.resetAt?(G.delete(t),!1):n.count>=oo:!1}function ao(t,e){let n=G.get(t);if(!n||e>=n.resetAt){if(G.size>=Xn){for(let[r,o]of G)e>=o.resetAt&&G.delete(r);G.size>=Xn&&G.clear()}G.set(t,{count:1,resetAt:e+Wn});return}n.count+=1}function A(t,e=200,n={}){return new Response(JSON.stringify(t),{status:e,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store",...n}})}function R(t,e){return A({ok:!1,error:t},e)}async function uo(t,e){let n=await t.get(jt);if(n)return n;if(typeof e.SCANNER_TOKEN=="string"&&e.SCANNER_TOKEN)return e.SCANNER_TOKEN;let r=L(24);return await t.put(jt,r),r}async function lo(t,e,n){if(!e.pathname.startsWith(be))return null;let{store:r,env:o,config:s,auth:a}=n,i=e.pathname.slice(be.length)||"/",c=t.method.toUpperCase();if(i==="/session"&&c==="GET"){let l=await ie(r,t);return A({ok:!0,authenticated:l,panelPath:a.panelPath})}if(i==="/login"&&c==="POST"){let l="";try{let h=await t.json();l=String(h.password??"")}catch{return R(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}if(!l)return R(__sfx("6K+36L6T5YWl5a+G56CB"),400);let u=so(t),f=Date.now();if(io(u,f))return new Response(JSON.stringify({ok:!1,error:__sfx("5bCd6K+V6L+H5LqO6aKR57mB77yM6K+356iN5ZCO5YaN6K+V")}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(Wn/1e3))}});let d=await Sn(a,l);if(!d.ok)return ao(u,f),R(__sfx("5a+G56CB6ZSZ6K+v"),401);G.delete(u),d.legacy&&await An(r,l).catch(()=>{}),await En(r).catch(()=>{});let g=await xn(r);return A({ok:!0},200,{"Set-Cookie":Tn(g)})}if(i==="/logout"&&c==="POST")return await In(r,t),A({ok:!0},200,{"Set-Cookie":Nn()});if(i==="/preferred-ips"&&c==="POST"){let l=t.headers.get("Authorization")??"",u=l.startsWith("Bearer ")?l.slice(7).trim():l.trim();if(!await kn(r,u))return R(__sfx("VG9rZW4g5qCh6aqM5aSx6LSl"),401);let d;try{d=await t.json()}catch{return R(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}let g=Array.isArray(d.ips)?d.ips.map(M=>String(M)):[],h=g.map(M=>M.trim()).filter(M=>M.length>0).join(`
|
|
6
|
+
`))}function en(t,e){let n=Vt(e.config.subName);switch(t){case __sfx("Y2xhc2g="):return{body:Hr(e),contentType:"text/yaml; charset=utf-8",fileName:n};case"singbox":return{body:Br(e),contentType:"application/json; charset=utf-8",fileName:n};default:return{body:Fr(e),contentType:"text/plain; charset=utf-8",fileName:n}}}var $,mr,gr,Fe,je,Ge,hr,br,yr,Ir,kr,Or,_,Lr,We,Ve,vr,Qe,qt=I(()=>{"use strict";De();K();zt();Be();$=443;mr=[__sfx("aXDlnLDlnYA="),__sfx("aXAg5Zyw5Z2A"),"ip",__sfx("5Zyw5Z2A"),__sfx("5pyN5Yqh5Zmo"),"server","host"],gr=[__sfx("56uv5Y+j"),"port"],Fe=[__sfx("5LiL6L296YCf5bqm"),__sfx("6YCf5bqm"),"speed","download"],je=[__sfx("5bmz5Z2H5bu26L+f"),__sfx("5bu26L+f"),"latency","delay",__sfx("5ZON5bqU5pe26Ze0"),"rtt"],Ge=["colo",__sfx("5py65oi/"),__sfx("5pWw5o2u5Lit5b+D"),__sfx("5Zyw5Yy6"),"region"],hr=[__sfx("5Zu95a62"),"country",__sfx("5Zu95Yir")],br=[__sfx("5Z+O5biC"),"city"],yr=["tls",__sfx("5piv5ZCm5pSv5oyBdGxz"),__sfx("5pSv5oyBdGxz")];Ir={official:__sfx("5a6Y5pa55LyY6YCJSVA="),domain:__sfx("5LyY6YCJ5Z+f5ZCN"),manual:__sfx("5omL5Yqo5LyY6YCJSVA="),api:__sfx("6L+c56iLQVBJ"),csv:__sfx("5rWL6YCfQ1NW")};kr=12e4,Or=32,_=new Map,Lr="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36";We=[__sfx("dmxlc3Mtd3M="),__sfx("dmxlc3MteGh0dHA="),__sfx("dHJvamFu")];Ve=[__sfx("dmxlc3Mtd3M="),__sfx("dHJvamFu")];vr=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;Qe=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});function Zr(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function un(t,e){let n=await crypto.subtle.importKey("raw",an.encode(t),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",n,an.encode(e));return Zr(new Uint8Array(r))}async function Nt(t){let e=(await t.get(Tt))?.trim();if(e)return e;let n=ln();return t instanceof X&&await t.put(Tt,n),n}async function cn(t){let e=ln();return t instanceof X?await t.put(Tt,e):await t.put(Tt,e),e}async function fn(t,e={}){let n=e.ttlDays??0,r=Math.floor((e.now??Date.now())/1e3),o=n>0?r+Math.round(n*86400):0,s=Math.floor(Math.random()*36**8).toString(36).padStart(8,"0"),a=`${te}.${o.toString(36)}.${s}`,i=(await un(t,a)).slice(0,ee);return`${a}.${i}`}async function It(t,e,n=Date.now()){if(!t||!e)return{ok:!1,reason:"format"};let r=e.split(".");if(r.length!==4||r[0]!==te)return{ok:!1,reason:"format"};let o=r[1],s=r[2],a=r[3];if(!o||!s||a.length!==ee)return{ok:!1,reason:"format"};let i=Number.parseInt(o,36);if(!Number.isFinite(i)||i<0)return{ok:!1,reason:"format"};let c=(await un(t,`${te}.${o}.${s}`)).slice(0,ee);return Y(a,c)?i>0&&Math.floor(n/1e3)>=i?{ok:!1,reason:"expired",exp:i}:{ok:!0,exp:i}:{ok:!1,reason:"signature"}}var Tt,te,ee,an,ln,ne=I(()=>{"use strict";yt();K();Tt="SUB_TOKEN_SECRET",te="v1",ee=22,an=new TextEncoder;ln=()=>L(32)});function Jr(t){let e="";for(let n of t)e+=(n<16?"0":"")+n.toString(16);return e}function qr(t){if(!/^[0-9a-f]*$/.test(t)||t.length%2!==0)return null;let e=new Uint8Array(new ArrayBuffer(t.length/2));for(let n=0;n<e.length;n++)e[n]=Number.parseInt(t.slice(n*2,n*2+2),16);return e}async function yn(t,e,n){let r=qr(e);if(!r)return null;let o=await crypto.subtle.importKey("raw",new TextEncoder().encode(t),"PBKDF2",!1,["deriveBits"]),s=await crypto.subtle.deriveBits({name:"PBKDF2",salt:r,iterations:n,hash:"SHA-256"},o,256);return Jr(new Uint8Array(s))}function wn(t){if(t.startsWith(`${oe}$`)){let[r,o,s,a]=t.split("$");if(r!==oe||!s||!a)return null;let i=Number.parseInt(o??"",10);return!Number.isFinite(i)||i<1||i>1e6?null:{scheme:"pbkdf2",salt:s,iterations:i,expected:a}}let[e,n]=t.split(":");return!e||!n?null:{scheme:"sha256",salt:e,iterations:0,expected:n}}async function Pn(t,e){return t.scheme==="pbkdf2"?await yn(e,t.salt,t.iterations):await Ht(`${t.salt}:${e}`)}async function se(t,e){let n=await yn(t,e,gn);return n?`${oe}$${gn}$${e}$${n}`:`${e}:${await Ht(`${e}:${t}`)}`}async function _r(t,e){let n=wn(t);if(!n)return!1;let r=await Pn(n,e);return r?Y(r,n.expected):!1}function hn(t){return`/${t.trim().replace(/^\/+/,"")}`}async function Cn(t,e,n){let r=await t.get(Ct)??"",o=n&&n.trim()?hn(n):"";o?r!==o&&(r=o,await t.put(Ct,r)):r||(r=hn(`${Re}-${Pe(6)}`),await t.put(Ct,r));let s=await t.get(it)??"",a=null,i=e&&e.trim()?e.trim():"";if(i){if(!s||!await _r(s,i)){let p=L(8);s=await se(i,p),await t.put(it,s)}await t.get(nt)&&await t.delete(nt)}else if(!s){let c=`cfp-${L(8)}`,p=L(8);s=await se(c,p),await t.put(it,s),a=c,await t.put(nt,c)}return{panelPath:r,passwordHash:s,generatedPassword:a}}async function Sn(t,e){let n=wn(t.passwordHash);if(!n)return{ok:!1,legacy:!1};let r=await Pn(n,e);if(!r)return{ok:!1,legacy:!1};let o=Y(r,n.expected);return{ok:o,legacy:o&&n.scheme==="sha256"}}async function An(t,e){let n=L(8);await t.put(it,await se(e,n))}async function En(t){await t.get(nt)&&await t.delete(nt)}function Rn(t){let e=t.headers.get("Cookie")??"",n={};for(let r of e.split(";")){let o=r.indexOf("=");if(o<0)continue;let s=r.slice(0,o).trim(),a=r.slice(o+1).trim();s&&(n[s]=decodeURIComponent(a))}return n}async function xn(t){let e=L(24);return await t.put(`${Pt}${e}`,JSON.stringify({ua:"",t:Date.now()}),bn),e}async function ie(t,e){let n=Rn(e)[kt];return n?!!await t.get(`${Pt}${n}`):!1}function Tn(t,e=bn){return`${kt}=${t}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=${e}`}function Nn(){return`${kt}=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=0`}async function In(t,e){let n=Rn(e)[kt];n&&await t.delete(`${Pt}${n}`)}async function Dn(t){let e=L(20);return await t.put(`${wt}${e}`,"1",Vr),e}async function kn(t,e){if(!e)return!1;let n=await t.get("SCANNER_TOKEN");return n&&Y(n,e)?!0:await t.get(`${wt}${e}`)?(await t.delete(`${wt}${e}`),!0):!1}var kt,bn,Vr,gn,oe,ae=I(()=>{"use strict";ft();K();kt=__sfx("Y2ZwaWxvdF9zZXNz"),bn=3600*24,Vr=600,gn=3e4,oe="pbkdf2"});function On(t){return Se(t)}async function ue(t,e){if(v.config&&Date.now()-v.configAt<$r)return v.config;let n=await Ne(t,e);return v.config=n,v.configAt=Date.now(),n}function Ln(){v.config=null,v.configAt=0}async function le(t,e){if(v.auth&&Date.now()-v.authAt<to)return v.auth;let n=await Cn(t,e.PANEL_PASSWORD,e.PANEL_PATH);return v.auth=n,v.authAt=Date.now(),n}function ce(t){switch((t??"").toLowerCase()){case __sfx("Y2xhc2g="):case"mihomo":case"yaml":return __sfx("Y2xhc2g=");case"singbox":case"sing-box":case"json":return"singbox";case"v2ray":return"v2ray";case"base64":return"base64";default:return"base64"}}function bt(t){let e=String(t??"").trim();if(!e)return e;e=e.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,""),e=e.replace(/[/?#].*$/,"");let n=e.lastIndexOf("@");if(n>=0&&(e=e.slice(n+1)),e.startsWith("[")){let r=e.indexOf("]");r>0&&(e=e.slice(1,r))}else{let r=e.indexOf(":");r>=0&&e.indexOf(":",r+1)<0&&(e=e.slice(0,r))}return e.trim()}function vn(t){let e=(t??"").toLowerCase();return e?e.includes(__sfx("Y2xhc2g="))||e.includes("mihomo")||e.includes(__sfx("ZmxjbGFzaA=="))||e.includes(__sfx("Y2xhc2h4"))||e.includes("stash")?__sfx("Y2xhc2g="):e.includes("sing-box")||e.includes("singbox")?"singbox":e.includes("v2ray")||e.includes("v2rayng")||e.includes("shadowrocket")||e.includes("nekobox")||e.includes("surge")||e.includes("loon")||e.includes("quantumult")?"base64":null:null}var $r,to,v,Ot=I(()=>{"use strict";yt();ft();ae();$r=15e3,to=6e4,v={config:null,configAt:0,auth:null,authAt:0}});function fe(t,e,n){if(!t){n.push({field:e,message:""+e+__sfx("IOS4jeiDveS4uuepug==")});return}if(!t.startsWith("/")){n.push({field:e,message:""+e+__sfx("IOW/hemhu+S7pSAvIOW8gOWktA==")});return}if(t.length>128){n.push({field:e,message:""+e+__sfx("IOi/h+mVv++8iOacgOWkmiAxMjgg5a2X56ym77yJ")});return}/[\s\u0000-\u001f]/.test(t)&&n.push({field:e,message:""+e+__sfx("IOS4jeiDveWMheWQq+epuuagvOaIluaOp+WItuWtl+espg==")})}function tt(t,e,n,r,o){if(!Number.isFinite(t)){o.push({field:e,message:""+e+__sfx("IOW/hemhu+aYr+aVsOWtlw==")});return}(t<n||t>r)&&o.push({field:e,message:""+e+__sfx("IOW/hemhu+WcqCA=")+n+" ~ "+r+__sfx("IOS5i+mXtO+8iOW9k+WJjSA=")+t+")"})}function Lt(t,e,n){let r=t.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>20){n.push({field:e,message:""+e+__sfx("IOacgOWkmiAyMCDmnaHvvIjlvZPliY0g")+r.length+")"});return}for(let o of r)if(!no.test(o)){n.push({field:e,message:""+e+__sfx("IOmHjOacieaXoOazleivhuWIq+eahOadoeebru+8mg==")+o.slice(0,40)+""});return}}function Un(t,e,n){let r=t.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>10){n.push({field:e,message:""+e+__sfx("IOacgOWkmiAxMCDmnaHvvIjlvZPliY0g")+r.length+")"});return}for(let o of r)if(!/^https?:\/\/\S+$/i.test(o)){n.push({field:e,message:""+e+__sfx("IOW/hemhu+aYryBodHRwKHMpIOWcsOWdgO+8mg==")+o.slice(0,40)+""});return}}function pe(t){let e=[],n=o=>Object.prototype.hasOwnProperty.call(t,o);n("wsPath")&&fe(String(t.wsPath??""),"wsPath",e),n(__sfx("dHJvamFuUGF0aA=="))&&fe(String(t.trojanPath??""),__sfx("dHJvamFuUGF0aA=="),e),n(__sfx("eGh0dHBQYXRo"))&&fe(String(t.xhttpPath??""),__sfx("eGh0dHBQYXRo"),e);let r=["wsPath",__sfx("dHJvamFuUGF0aA=="),__sfx("eGh0dHBQYXRo")].filter(o=>n(o)).map(o=>`${o}=${String(t[o]??"")}`);if(r.length>=2){let o=r.map(s=>s.slice(s.indexOf("=")+1));new Set(o).size!==o.length&&e.push({field:"paths",message:__sfx("d3NQYXRoIC8gdHJvamFuUGF0aCAvIHhodHRwUGF0aCDkuI3og73ph43lpI0=")})}if(n("subDomain")){let o=String(t.subDomain??"").trim();o&&(!eo.test(o)||o.includes("/"))&&e.push({field:"subDomain",message:__sfx("c3ViRG9tYWluIOW/hemhu+aYr+WQiOazleS4u+acuuWQje+8iOS4jeWQq+WNj+iuruS4jui3r+W+hO+8iQ==")})}if(n(__sfx("cHJveHlJcA=="))&&Lt(String(t.proxyIp??""),__sfx("cHJveHlJcA=="),e),n(__sfx("c29ja3M1"))&&Lt(String(t.socks5??""),__sfx("c29ja3M1"),e),n("httpProxy")&&Lt(String(t.httpProxy??""),"httpProxy",e),n("relayPool")&&Lt(String(t.relayPool??""),"relayPool",e),n("officialCount")&&tt(Number(t.officialCount),"officialCount",1,200,e),n("domainCount")&&tt(Number(t.domainCount),"domainCount",1,200,e),n("maxNodes")&&tt(Number(t.maxNodes),"maxNodes",0,500,e),n("dls")&&tt(Number(t.dls),"dls",0,1e3,e),n("maxLatency")&&tt(Number(t.maxLatency),"maxLatency",0,1e4,e),n("dataBudgetMB")&&tt(Number(t.dataBudgetMB),"dataBudgetMB",0,102400,e),n("subTokenTtlDays")&&tt(Number(t.subTokenTtlDays),"subTokenTtlDays",0,3650,e),n("subPorts")){let o=String(t.subPorts??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>6?e.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg5pyA5aSaIDYg5Liq56uv5Y+j")}):s.every(a=>/^\d{1,5}$/.test(a)&&Number(a)>=1&&Number(a)<=65535)||e.push({field:"subPorts",message:__sfx("c3ViUG9ydHMg6YeM5q+P5Liq56uv5Y+j6YO95b+F6aG75pivIDF+NjU1MzUg55qE5pWw5a2X")})}}if(n("subName")){let o=String(t.subName??"");o.length>40&&e.push({field:"subName",message:__sfx("c3ViTmFtZSDmnIDlpJogNDAg5a2X56ym")}),/[\u0000-\u001f]/.test(o)&&e.push({field:"subName",message:__sfx("c3ViTmFtZSDkuI3og73ljIXlkKvmjqfliLblrZfnrKY=")})}if(n("addApi")&&Un(String(t.addApi??""),"addApi",e),n("addCsv")&&Un(String(t.addCsv??""),"addCsv",e),n("uuid")){let o=String(t.uuid??"").trim();o&&!/^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$/.test(o)&&e.push({field:"uuid",message:__sfx("dXVpZCDlv4XpobvmmK/moIflh4YgVVVJRO+8iDM2IOS9je+8jOWPr+W4pui/nuWtl+espu+8iQ==")})}if(n("poolCountries")){let o=String(t.poolCountries??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>30?e.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDmnIDlpJogMzAg5Liq5Zu95a62L+WcsOWMug==")}):s.every(a=>/^[A-Za-z]{2,3}$/.test(a))||e.push({field:"poolCountries",message:__sfx("cG9vbENvdW50cmllcyDlj6rog73mmK8gMn4zIOS9jeWtl+avjeS7o+eggQ==")})}}if(n("udpDnsEndpoint")){let o=String(t.udpDnsEndpoint??"").trim();o&&!/^https:\/\/\S+$/i.test(o)&&e.push({field:"udpDnsEndpoint",message:__sfx("dWRwRG5zRW5kcG9pbnQg5b+F6aG75pivIGh0dHBzIOWcsOWdgA==")})}return e}function de(t){return t.length===0?"":t.length===1?t[0].message:"有 "+t.length+__sfx("IOmhuemFjee9ruS4jeWQiOazle+8mg==")+t.map(e=>e.message).join("\uFF1B")+""}var eo,no,Mn=I(()=>{"use strict";eo=/^(?=.{1,253}$)([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)(\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,no=/^(?:(?:socks5|socks|socks5h|http|https):\/\/)?(?:[^\s@/]+@)?(?:\[[0-9a-fA-F:]+\]|[A-Za-z0-9._-]+)(?::\d{1,5})?$/});function Fn(t,e=Date.now()){let n={};for(let o of Bn){let s=t[o];s!==void 0&&(n[o]=s)}let r=ro.map(o=>({field:o.field,reason:o.reason}));for(let o of[__sfx("c29ja3M1"),"httpProxy"]){let s=String(t[o]??"");if(!s){n[o]="";continue}if(s.includes("@")){r.push({field:o,reason:__sfx("5ZCr55So5oi35ZCNL+WPo+S7pO+8jOmcgOaJi+W3pemHjeaWsOWhq+WGmQ==")});continue}n[o]=s}return{schemaVersion:1,exportedAt:new Date(e).toISOString(),config:n,omitted:r}}function jn(t){let e=new Set([...Bn.map(String),__sfx("c29ja3M1"),"httpProxy"]),n={};for(let[r,o]of Object.entries(t))e.has(r)&&(n[r]=o);return n}function Hn(t){if(t==null)return"\uFF08\u7A7A\uFF09";if(typeof t=="string"){let e=t.replace(/\s+/g," ").trim();return e.length>60?`${e.slice(0,60)}\u2026`:e||"\uFF08\u7A7A\uFF09"}return String(t)}function Gn(t,e){let n=[];for(let[r,o]of Object.entries(e)){let s=t[r];String(s)!==String(o)&&n.push({field:r,from:Hn(s),to:Hn(o)})}return n}var Bn,ro,Yn=I(()=>{"use strict";Bn=["poolOfficial","officialCount","poolDomain","domainCount","poolManual","poolCountries","add","dls","maxLatency","maxNodes",__sfx("cHJveHlJcA=="),"relayPool","useBuiltinRelay","proxyMode","nat64","concurrentDial","dataBudgetMB","resolvePreferred",__sfx("ZW5hYmxlVHJvamFu"),__sfx("ZW5hYmxlWGh0dHA="),"subProtocol","subTransport","subVariants","subName","subPorts","clientFingerprint","ech","echHost","echDns","tlsFragment","tlsFragmentSize","tlsFragmentDelay","subToken","subTokenTtlDays","unlockProbe","udpDns","udpDnsEndpoint"],ro=[{field:"uuid",reason:__sfx("5YWl56uZ5Yet5o2u")},{field:__sfx("dHJvamFuUGFzc3dvcmQ="),reason:__sfx("5YWl56uZ5Yet5o2u")},{field:"wsPath",reason:__sfx("5a6e5L6L5qCH6K+G77yI6K6i6ZiF6ZO+5o6l6YeM5Y+v6KeB77yM5a+85Ye65Y2z5pq06Zyy5YWl5Y+j77yJ")},{field:__sfx("dHJvamFuUGF0aA=="),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:__sfx("eGh0dHBQYXRo"),reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"subDomain",reason:__sfx("5a6e5L6L5qCH6K+G")},{field:"addApi",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")},{field:"addCsv",reason:__sfx("VVJMIOWPr+iDveWQq+engeaciSB0b2tlbg==")}]});function Kn(){return new Response(JSON.stringify({build:me,version:ge,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var me,ge,zn,he=I(()=>{"use strict";me="56a28f5-6a8a5b51",ge=__sfx("MC4xMy4xMQ=="),zn=__sfx("L19fY2ZwX3ZlcnNpb24=")});var Zn={};tr(Zn,{API_PREFIX:()=>be,getScannerToken:()=>uo,handleApi:()=>lo});function so(t){return t.headers.get("CF-Connecting-IP")??t.headers.get("x-forwarded-for")?.split(",")[0]?.trim()??"unknown"}function io(t,e){let n=G.get(t);return n?e>=n.resetAt?(G.delete(t),!1):n.count>=oo:!1}function ao(t,e){let n=G.get(t);if(!n||e>=n.resetAt){if(G.size>=Xn){for(let[r,o]of G)e>=o.resetAt&&G.delete(r);G.size>=Xn&&G.clear()}G.set(t,{count:1,resetAt:e+Wn});return}n.count+=1}function A(t,e=200,n={}){return new Response(JSON.stringify(t),{status:e,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store",...n}})}function R(t,e){return A({ok:!1,error:t},e)}async function uo(t,e){let n=await t.get(jt);if(n)return n;if(typeof e.SCANNER_TOKEN=="string"&&e.SCANNER_TOKEN)return e.SCANNER_TOKEN;let r=L(24);return await t.put(jt,r),r}async function lo(t,e,n){if(!e.pathname.startsWith(be))return null;let{store:r,env:o,config:s,auth:a}=n,i=e.pathname.slice(be.length)||"/",c=t.method.toUpperCase();if(i==="/session"&&c==="GET"){let l=await ie(r,t);return A({ok:!0,authenticated:l,panelPath:a.panelPath})}if(i==="/login"&&c==="POST"){let l="";try{let h=await t.json();l=String(h.password??"")}catch{return R(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}if(!l)return R(__sfx("6K+36L6T5YWl5a+G56CB"),400);let u=so(t),f=Date.now();if(io(u,f))return new Response(JSON.stringify({ok:!1,error:__sfx("5bCd6K+V6L+H5LqO6aKR57mB77yM6K+356iN5ZCO5YaN6K+V")}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(Wn/1e3))}});let d=await Sn(a,l);if(!d.ok)return ao(u,f),R(__sfx("5a+G56CB6ZSZ6K+v"),401);G.delete(u),d.legacy&&await An(r,l).catch(()=>{}),await En(r).catch(()=>{});let g=await xn(r);return A({ok:!0},200,{"Set-Cookie":Tn(g)})}if(i==="/logout"&&c==="POST")return await In(r,t),A({ok:!0},200,{"Set-Cookie":Nn()});if(i==="/preferred-ips"&&c==="POST"){let l=t.headers.get("Authorization")??"",u=l.startsWith("Bearer ")?l.slice(7).trim():l.trim();if(!await kn(r,u))return R(__sfx("VG9rZW4g5qCh6aqM5aSx6LSl"),401);let d;try{d=await t.json()}catch{return R(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}let g=Array.isArray(d.ips)?d.ips.map(M=>String(M)):[],h=g.map(M=>M.trim()).filter(M=>M.length>0).join(`
|
|
7
7
|
`);await r.get(j)!==h&&await r.put(j,h);let P={};(s.add??"").trim()!==""&&(P.add=""),s.poolManual||(P.poolManual=!0);let k=!1;return Object.keys(P).length>0&&(await ut(r,at(s,P)),n.onConfigChanged(),k=P.add!==void 0),A({ok:!0,count:g.length,clearedManual:k,enabledManual:P.poolManual===!0})}if(!await ie(r,t))return R(__sfx("5pyq55m75b2V5oiW5Lya6K+d5bey6L+H5pyf"),401);if(i==="/status"&&c==="GET"){let l=await lt(r),u=gt(l),f=bt(s.subDomain||o.DATA_HOST||e.hostname);return A({ok:!0,panelPath:a.panelPath,domain:e.hostname,nodeDomain:f,dataHost:o.DATA_HOST??"",colo:t.cf?.colo??"UNK",coloLabel:dt(t.cf?.colo??""),localIps:u.length,generatedPassword:a.generatedPassword,version:me,pkgVersion:ge,readAt:Date.now()})}if(i==="/config"&&c==="GET")return A({ok:!0,config:s});if(i==="/config"&&c==="PUT"){let l;try{l=await t.json()}catch{return R(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}if(!l.config||typeof l.config!="object")return R(__sfx("57y65bCR6YWN572u5a+56LGh"),400);let u=pe(l.config);if(u.length>0)return R(de(u),400);let f=at(s,l.config);return await ut(r,f),n.onConfigChanged(),A({ok:!0,config:f})}if(i==="/config/export"&&c==="GET")return A({ok:!0,...Fn(s)});if(i==="/config/import"&&c==="POST"){let l;try{l=await t.json()}catch{return R(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}if(!l.config||typeof l.config!="object")return R(__sfx("57y65bCR6YWN572u5a+56LGh"),400);let u=jn(l.config);if(Object.keys(u).length===0)return R(__sfx("5rKh5pyJ5Y+v5a+85YWl55qE5a2X5q6177yI56Gu6K6k5piv5pys6aG555uu5a+85Ye655qE6YWN572u5paH5Lu277yf77yJ"),400);let f=pe(u);if(f.length>0)return R(de(f),400);let d=Gn(s,u);if(l.dryRun)return A({ok:!0,dryRun:!0,diff:d,count:d.length});if(d.length===0)return A({ok:!0,applied:0,diff:[],config:s});let g=at(s,u);return await ut(r,g),n.onConfigChanged(),A({ok:!0,applied:d.length,diff:d,config:g})}if(i==="/ips"&&c==="GET"){let l=await lt(r),u=gt(l);return A({ok:!0,raw:l,count:u.length,entries:u})}if(i==="/ips"&&c==="DELETE")return await r.delete(j),A({ok:!0});if(i==="/ips"&&c==="PUT"){let l;try{l=await t.json()}catch{return R(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}if(typeof l.raw!="string")return R(__sfx("57y65bCRIHJhdyDlrZfmrrU="),400);let u=l.raw.split(/\r?\n/).map(f=>f.trim()).filter(f=>f.length>0).join(`
|
|
8
8
|
`);return u?await r.put(j,u):await r.get(j)!==null&&await r.delete(j),A({ok:!0,count:u?u.split(`
|
|
9
9
|
`).length:0})}if(i==="/nodes"&&c==="GET"){let l=await lt(r),u=await ct(r),f=new rt(8),d=await xt(s,l,{budget:f,domainPool:u.length>0?u:void 0,bypassRemoteCache:!0});return A({ok:!0,count:d.nodes.length,nodes:d.nodes.slice(0,200).map(g=>({...g,coloLabel:g.colo?dt(g.colo):""})),groups:d.groups.map(g=>({key:g.key,name:g.name,count:g.entries.length})),stats:d.stats})}if(i==="/pool/meta"&&c==="GET"){let l=await ct(r);return A({ok:!0,countries:Ue.map(u=>({code:u,name:Oe[u]??u})),limits:{officialCount:200,domainCount:100},builtin:{cidrs:St.length,domains:pt.length},customDomains:l})}if(i==="/pool/library"&&c==="PUT"){let l;try{l=await t.json()}catch{return R(__sfx("6K+35rGC5L2T6Kej5p6Q5aSx6LSl"),400)}let u=Array.isArray(l.domains)?l.domains.map(f=>String(f)):[];return await Ie(r,u),A({ok:!0,count:u.filter(f=>f.trim()).length})}if(i==="/scanner-token"&&c==="POST"){let l=await Dn(r);return A({ok:!0,token:l,expiresIn:600})}if(i==="/sub-token"&&(c==="GET"||c==="POST")){let l=c==="POST",u=l?await cn(r):await Nt(r),f=await fn(u,{ttlDays:s.subTokenTtlDays}),d=await It(u,f);return A({ok:!0,rotated:l,mode:s.subToken,ttlDays:s.subTokenTtlDays,token:f,link:`${e.origin}/sub/${f}`,expiresAt:(d.exp??0)*1e3})}return i==="/events"&&c==="GET"?await co(t,r):R(__sfx("5o6l5Y+j5LiN5a2Y5Zyo"),404)}async function co(t,e){let n=new TextEncoder,r="",o,s=new ReadableStream({async start(a){let i=()=>{o&&clearTimeout(o);try{a.close()}catch{}};t.signal.addEventListener("abort",i);let c=async()=>{try{let p=await lt(e);if(p!==r){r=p;let l=gt(p).length;a.enqueue(n.encode(__sfx("ZXZlbnQ6IGlwcwpkYXRhOiA=")+JSON.stringify({count:l})+"\n\n"))}else a.enqueue(n.encode(`: keepalive
|
package/assets/dataplane.js
CHANGED
|
@@ -2,4 +2,4 @@ const __sfx=(()=>{const __t=new TextDecoder(),__c=new Map();return b=>{let v=__c
|
|
|
2
2
|
`);await i.write(new TextEncoder().encode(f));let l=Date.now()+Xe,u="";for(;;){let R=s.peek(),C=gr(R);if(C>=0){u=new TextDecoder().decode(R.subarray(0,C)),s.skip(C+4);break}if(R.byteLength>8192)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTlpLTotoXov4cgODE5MiDlrZfoioI="));let p=l-Date.now();if(p<=0)throw new Error(__sfx("SFRUUCDku6PnkIbmj6HmiYvotoXml7bvvIg=")+Xe+__sfx("bXMg5peg5ZON5bqU77yJ"));let w=null,S;try{S=await Promise.race([s.fill(),new Promise(I=>{w=setTimeout(()=>I("timeout"),p)})])}finally{w&&clearTimeout(w)}if(S==="timeout")throw new Error(__sfx("SFRUUCDku6PnkIbmj6HmiYvotoXml7bvvIg=")+Xe+__sfx("bXMg5peg5ZON5bqU77yJ"));if(S===null)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTkuI3lrozmlbTvvIjov57mjqXooqvmj5DliY3lhbPpl63vvIk="))}let h=u.split(`\r
|
|
3
3
|
`)[0]??"",y=/^HTTP\/1\.[01]\s+(\d{3})/.exec(h);if(!y)throw new Error(__sfx("SFRUUCDku6PnkIblk43lupTpnZ7ms5U="));if(y[1]!=="200")throw new Error(__sfx("SFRUUCDku6PnkIYgQ09OTkVDVCDlpLHotKXvvJo=")+y[1]+"");return s.release()}finally{try{i.releaseLock()}catch{}}}var hr,Xe,Xt=x(()=>{"use strict";ie();hr=[13,10,13,10];Xe=6e3});function Ze(e){if(e instanceof Q||(e instanceof Error?e.message:String(e)).includes(Vt))return!0;let n=e instanceof Error?e.cause:void 0;return n!==void 0&&n!==e&&Ze(n)}function Zt(e){let t=e.split(".");if(t.length!==4)return null;let n=0;for(let o of t){if(!/^\d{1,3}$/.test(o))return null;let r=Number(o);if(r>255)return null;n=n*256+r}return n>>>0}function Jt(e){let t=Zt(e);if(t===null)return null;for(let[n,o,r,s]of yr){let i=Zt(n);if(i===null)continue;let a=o===0?0:4294967295<<32-o>>>0;if((t&a)===(i&a))return{kind:r,reason:s}}return null}function br(e){let t=e.split("%")[0]??"";if(!t.includes(":"))return null;if(t.startsWith("::"))return 0;let n=t.split(":")[0]??"";if(n==="")return 0;let o=Number.parseInt(n,16);return Number.isFinite(o)?o:null}function wr(e){let t=(e.split("%")[0]??"").toLowerCase();if(!t.includes(":"))return null;if(/ffff:/i.test(t)){let o=/(\d{1,3}(?:\.\d{1,3}){3})$/.exec(t);if(o){let r=Jt(o[1]);return r||null}}let n=br(t);return n===null?null:t==="::"||n===0?t==="::1"?{kind:"loopback",reason:__sfx("546v5Zue5Zyw5Z2A")}:t==="::"?{kind:"unspecified",reason:__sfx("5pyq5oyH5a6a5Zyw5Z2A")}:null:(n&65024)===64512?{kind:"ula",reason:__sfx("SVB2NiDllK/kuIDmnKzlnLDlnLDlnYA=")}:(n&65472)===65152?{kind:"link-local",reason:__sfx("SVB2NiDpk77ot6/mnKzlnLDlnLDlnYA=")}:(n&65280)===65280?{kind:"multicast",reason:__sfx("SVB2NiDnu4Tmkq3lnLDlnYA=")}:null}function Ve(e){let t=e.trim().toLowerCase().replace(/^\[|\]$/g,"");if(t==="")return null;if(t.includes(":"))return wr(t);if(/^\d{1,3}(?:\.\d{1,3}){3}$/.test(t))return Jt(t);if(t==="localhost"||t.endsWith(".localhost"))return{kind:"loopback",reason:__sfx("546v5Zue5Li75py65ZCN")};for(let n of xr)if(t.endsWith(n))return{kind:"internal-name",reason:__sfx("5YaF572R5Z+f5ZCN5ZCO57yA")};return null}var Vt,Q,yr,xr,Je=x(()=>{"use strict";Vt=__sfx("55uu5qCH5Zyw5Z2A6KKr562W55Wl5oum5oiq"),Q=class extends Error{kind;constructor(t,n){super(`${Vt}\uFF1A${t}\uFF08${n.reason}\uFF09`),this.name="TargetBlockedError",this.kind=n.kind}};yr=[[__sfx("MC4wLjAuMA=="),8,"unspecified",__sfx("5pyq5oyH5a6a5Zyw5Z2A")],[__sfx("MTAuMC4wLjA="),8,"private",__sfx("56eB5pyJ572R5q61")],[__sfx("MTAwLjY0LjAuMA=="),10,"cgnat",__sfx("6L+Q6JCl5ZWG57qnIE5BVCDnvZHmrrU=")],[__sfx("MTI3LjAuMC4w"),8,"loopback",__sfx("546v5Zue5Zyw5Z2A")],[__sfx("MTY5LjI1NC4wLjA="),16,"link-local",__sfx("6ZO+6Lev5pys5ZywIC8g5LqR5YWD5pWw5o2u5Zyw5Z2A")],[__sfx("MTcyLjE2LjAuMA=="),12,"private",__sfx("56eB5pyJ572R5q61")],[__sfx("MTkyLjE2OC4wLjA="),16,"private",__sfx("56eB5pyJ572R5q61")],[__sfx("MjI0LjAuMC4w"),4,"multicast",__sfx("57uE5pKt5Zyw5Z2A")],[__sfx("MjQwLjAuMC4w"),4,"reserved",__sfx("5L+d55WZ5Zyw5Z2A")]];xr=[".local",".internal"]});function Er(e){return/^\d{1,3}(\.\d{1,3}){3}$/.test(e)?!0:e.includes(":")&&/^[0-9a-fA-F:.]+$/.test(e)}function Pr(e,t){let n=e.trim(),o=/^\[([^\]]+)\](?::(\d+))?$/.exec(n);if(o)return{host:o[1],port:Number(o[2]??t)};if(n.includes(":")&&n.split(":").length>2)return{host:n,port:t};let r=n.lastIndexOf(":");if(r<0)return{host:n,port:t};let s=n.slice(0,r),i=Number(n.slice(r+1));return s?{host:s,port:Number.isInteger(i)&&i>0?i:t}:{host:n,port:t}}async function Rr(e,t,n,o=$t){try{let r=`${e}?name=${encodeURIComponent(t)}&type=${n}`,s=await fetch(r,{headers:{accept:"application/dns-json"},signal:AbortSignal.timeout(o)});if(!s.ok)return[];let i=await s.json();if(!i||i.Status!==0||!Array.isArray(i.Answer))return[];let a=n==="TXT"?16:n==="A"?1:28;return i.Answer.filter(c=>c.type===a).map(c=>String(c.data))}catch{return[]}}async function qt(e,t,n={}){for(let o of Ar){if(n.deadline!==void 0&&Date.now()>=n.deadline)break;let r=n.timeoutMs??$t,s=n.deadline!==void 0?n.deadline-Date.now():Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")],i=Math.max(50,Math.min(r,s)),a=await Rr(o,e,t,i);if(a.length>0)return a}return[]}function Cr(e,t){let n=[],o=String(e).replace(/^"|"$/g,"").replace(/\\010/g,",").replace(/\\n/g,",").trim();if(!o||o===_t)return n;let r=o.split(/[,;\s]+/).filter(Boolean);if(r.length===0)return n;for(let s of r){let i=s.trim();if(!i)continue;let{host:a,port:c}=Pr(i,t);if(!O(a)&&!Z(a))return[];n.push({hostname:a,port:c})}return n}async function Ae(e,t,n={}){let o=e.trim();if(!o)return[];if(Er(o))return[{hostname:o,port:t}];let r=`${o}:${t}`,s=Qt.get(r);if(s&&Date.now()-s.at<Sr)return s.ips;let i=[],[a,c]=await Promise.all([n.skipTxt?Promise.resolve([]):qt(o,"TXT",n),qt(o,"A",n)]);if(!n.skipTxt)for(let u of a){let d=Cr(u,t);if(d.length>0){i.push(...d);break}if(String(u).replace(/^"|"$/g,"").replace(/\\010/g,",").trim()===_t)break}if(i.length===0)for(let u of c)O(u)&&i.push({hostname:u,port:t});let f=[],l=new Set;for(let u of i){let d=`${u.hostname}:${u.port}`;l.has(d)||(l.add(d),f.push(u))}return f.length>0&&Qt.set(r,{at:Date.now(),ips:f}),f}var _t,Ar,$t,Sr,Qt,Qe=x(()=>{"use strict";z();_t=__sfx("QGVkZ2V0dW5uZWw="),Ar=["https://cloudflare-dns.com/dns-query","https://dns.alidns.com/resolve","https://doh.pub/dns-query"],$t=4e3,Sr=300*1e3,Qt=new Map});var rt={};ge(rt,{[__sfx("QlVJTFRJTl9SRUxBWV9ET01BSU5T")]:()=>rn,[__sfx("QlVJTFRJTl9SRUxBWV9SRUdJT04=")]:()=>Ee,[__sfx("Q09MT19UT19DT1VOVFJZ")]:()=>on,[__sfx("UkVHSU9OX0FESkFDRU5DWQ==")]:()=>tn,[__sfx("UkVHSU9OX09SREVS")]:()=>_e,[__sfx("UkVMQVlfQkFUQ0hfU0laRQ==")]:()=>q,[__sfx("UkVMQVlfRE9NQUlOX0xJTUlU")]:()=>nt,[__sfx("VU5LTk9XTl9SRUdJT04=")]:()=>en,clearRelayCache:()=>Ur,collectRelayEndpoints:()=>ae,coloToCountry:()=>Se,rankRegions:()=>tt,regionOfEntry:()=>qe,resolveRelayEntry:()=>et,selectRelayDomains:()=>an,sortEndpointsByRegion:()=>nn});function qe(e){let n=e.trim().toLowerCase().replace(/:\d{1,5}$/,"");return Ee[n]??en}function tt(e){let t=(e??"").trim().toUpperCase();if(!t)return[..._e];let n=tn[t]??[],o=_e.filter(r=>r!==t&&!n.includes(r));return[t,...n,...o]}function nn(e,t){let n=tt(t),o=r=>{let s=n.indexOf(r);return s>=0?s:n.length};return e.map((r,s)=>({e:r,i:s})).sort((r,s)=>{let i=o(r.e.regionCode),a=o(s.e.regionCode);return i!==a?i-a:r.i-s.i}).map(r=>r.e)}function Se(e){let t=String(e??"").toUpperCase();return t?on[t]??(/^[A-Z]{2}$/.test(t)?t:"US"):"US"}async function et(e,t=443,n=sn,o={}){let r=e.trim();if(!r)return[];let s=`${r}:${t}:${n}`,i=$e.get(s);if(i&&Date.now()-i.at<Dr)return i.ips;let a=r,c=t,f=(r.match(/:/g)??[]).length;if(f===1){let u=/^(.*):(\d{1,5})$/.exec(r);u&&(a=u[1],c=Number(u[2]))}else if(f>1&&r.startsWith("[")){let u=/^\[([^\]]+)\]:(\d{1,5})$/.exec(r);u&&(a=u[1],c=Number(u[2]))}let l=[];if(O(a)||Z(a))l=[{ip:a,port:Number.isInteger(c)&&c>0?c:t,label:r,regionCode:qe(r)}];else try{l=(await Ae(a,c,{skipTxt:o.skipTxt,deadline:o.deadline,timeoutMs:o.timeoutMs})).slice(0,n).map(d=>({ip:d.hostname,port:d.port,label:`${a} \u2192 ${d.hostname}`,regionCode:qe(r)}))}catch{l=[]}return l.length>0&&$e.set(s,{at:Date.now(),ips:l}),l}function an(e,t=nt){let n=Se(e),o=tt(n),r=s=>{let i=Ee[s];if(!i)return o.length+1;let a=o.indexOf(i);return a>=0?a:o.length};return rn.map((s,i)=>({d:s,i,rank:r(s)})).sort((s,i)=>s.rank!==i.rank?s.rank-i.rank:s.i-i.i).map(s=>s.d).slice(0,Math.max(0,t))}async function ae(e={}){let t=e.perDomain??sn,n=[],o=new Set,r=p=>{for(let w of p){let S=`${w.ip}:${w.port}`;o.has(S)||(o.add(S),n.push(w))}},s=(e.userEntries??"").trim(),i=s?s.split(/[\n,;]+/).map(p=>p.trim()).filter(Boolean):[],a=e.domainLimit??nt,c=e.useBuiltin!==!1?an(e.colo,a):[],f=p=>e.perDomain!==void 0?t:Ee[p]===Se(e.colo)?Tr:kr,l=await Promise.all([...i.map(p=>et(p,443,t,{deadline:e.deadline,timeoutMs:e.timeoutMs})),...c.map(p=>et(p,443,f(p),{skipTxt:!0,deadline:e.deadline,timeoutMs:e.timeoutMs}))]),u=n.length;for(let p=0;p<i.length;p++)r(l[p]);let d=n.length-u,h=l.slice(i.length),y=h.reduce((p,w)=>Math.max(p,w.length),0);for(let p=0;p<y;p++)for(let w of h)p<w.length&&r([w[p]]);let R=n.slice(0,d),C=nn(n.slice(d),Se(e.colo));return[...R,...C]}function Ur(){$e.clear()}var en,tn,_e,Ee,rn,on,sn,q,nt,Tr,kr,Dr,$e,le=x(()=>{"use strict";z();Qe();en="??";tn={[__sfx("VVM=")]:["SG","JP","KR"],[__sfx("U0c=")]:["JP","KR","US"],[__sfx("SlA=")]:["SG","KR","US"],[__sfx("S1I=")]:["JP","SG","US"],[__sfx("REU=")]:["NL","GB","SE","FI"],[__sfx("U0U=")]:["DE","NL","FI","GB"],[__sfx("Tkw=")]:["DE","GB","SE","FI"],[__sfx("Rkk=")]:["SE","DE","NL","GB"],[__sfx("R0I=")]:["DE","NL","SE","FI"]},_e=["US","SG","JP","KR","DE","SE","NL","FI","GB"];Ee={[__sfx("cHJveHlpcC5oay5jbWxpdXNzc3MubmV0")]:"HK",[__sfx("cHJveHlpcC51cy5jbWxpdXNzc3MubmV0")]:"US",[__sfx("cHJveHlpcC5zZy5jbWxpdXNzc3MubmV0")]:"SG",[__sfx("cHJveHlpcC5qcC5jbWxpdXNzc3MubmV0")]:"JP",[__sfx("cHJveHlpcC5rci5jbWxpdXNzc3MubmV0")]:"KR",[__sfx("cHJveHlpcC5kZS5jbWxpdXNzc3MubmV0")]:"DE",[__sfx("cHJveHlpcC5zZS5jbWxpdXNzc3MubmV0")]:"SE",[__sfx("cHJveHlpcC5ubC5jbWxpdXNzc3MubmV0")]:"NL",[__sfx("cHJveHlpcC5maS5jbWxpdXNzc3MubmV0")]:"FI",[__sfx("cHJveHlpcC5nYi5jbWxpdXNzc3MubmV0")]:"GB",[__sfx("cHJveHlpcC5vcmFjbGUuY21saXVzc3NzLm5ldA==")]:"Oracle",[__sfx("cHJveHlpcC5kaWdpdGFsb2NlYW4uY21saXVzc3NzLm5ldA==")]:"DigitalOcean",[__sfx("cHJveHlpcC52dWx0ci5jbWxpdXNzc3MubmV0")]:"Vultr",[__sfx("cHJveHlpcC5tdWx0YWNvbS5jbWxpdXNzc3MubmV0")]:"Multacom"},rn=[__sfx("cHJveHlpcC5oay5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC5qcC5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC5zZy5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC51cy5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC5kZS5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC5nYi5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC5rci5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC5ubC5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC5zZS5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC5maS5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC5vcmFjbGUuY21saXVzc3NzLm5ldA=="),__sfx("cHJveHlpcC5kaWdpdGFsb2NlYW4uY21saXVzc3NzLm5ldA=="),__sfx("cHJveHlpcC52dWx0ci5jbWxpdXNzc3MubmV0"),__sfx("cHJveHlpcC5tdWx0YWNvbS5jbWxpdXNzc3MubmV0")],on={[__sfx("SEtH")]:"HK",[__sfx("U1lE")]:"AU",[__sfx("TUVM")]:"AU",[__sfx("Qk5F")]:"AU",[__sfx("UEVS")]:"AU",[__sfx("QURM")]:"AU",[__sfx("Q0JS")]:"AU",[__sfx("U0lO")]:"SG",[__sfx("TlJU")]:"JP",[__sfx("SE5E")]:"JP",[__sfx("S0lY")]:"JP",[__sfx("VFlP")]:"JP",[__sfx("T1NB")]:"JP",[__sfx("TkdP")]:"JP",[__sfx("Q1RT")]:"JP",[__sfx("RlVL")]:"JP",[__sfx("T0tB")]:"JP",[__sfx("SUNO")]:"KR",[__sfx("U0VM")]:"KR",[__sfx("UFVT")]:"KR",[__sfx("RlJB")]:"DE",[__sfx("TVVD")]:"DE",[__sfx("RFVT")]:"DE",[__sfx("QkVS")]:"DE",[__sfx("SEFN")]:"DE",[__sfx("U1RS")]:"DE",[__sfx("VklF")]:"DE",[__sfx("WlJI")]:"DE",[__sfx("Q0RH")]:"FR",[__sfx("TUFE")]:"ES",[__sfx("TVhQ")]:"IT",[__sfx("RkNP")]:"IT",[__sfx("UFJH")]:"CZ",[__sfx("V0FX")]:"PL",[__sfx("QVJO")]:"SE",[__sfx("QU1T")]:"NL",[__sfx("SEVM")]:"FI",[__sfx("TEhS")]:"GB",[__sfx("TEdX")]:"GB",[__sfx("TUFO")]:"GB",[__sfx("RURJ")]:"GB",[__sfx("TEFY")]:"US",[__sfx("U0pD")]:"US",[__sfx("U0ZP")]:"US",[__sfx("U0VB")]:"US",[__sfx("UERY")]:"US",[__sfx("U0FO")]:"US",[__sfx("TEFT")]:"US",[__sfx("UEhY")]:"US",[__sfx("U0xD")]:"US",[__sfx("REVO")]:"US",[__sfx("REZX")]:"US",[__sfx("SUFI")]:"US",[__sfx("QVVT")]:"US",[__sfx("T1JE")]:"US",[__sfx("TVNQ")]:"US",[__sfx("RFRX")]:"US",[__sfx("U1RM")]:"US",[__sfx("TUNJ")]:"US",[__sfx("QVRM")]:"US",[__sfx("TUlB")]:"US",[__sfx("TUNP")]:"US",[__sfx("Qk5B")]:"US",[__sfx("Q0xU")]:"US",[__sfx("SUFE")]:"US",[__sfx("Qk9T")]:"US",[__sfx("RVdS")]:"US",[__sfx("SkZL")]:"US",[__sfx("UEhM")]:"US",[__sfx("WVla")]:"CA",[__sfx("WVZS")]:"CA",[__sfx("WVVM")]:"CA",[__sfx("TUVY")]:"MX",[__sfx("R1JV")]:"BR",[__sfx("VFBF")]:"TW",[__sfx("S0hI")]:"TW",[__sfx("VFNB")]:"TW",[__sfx("Uk1R")]:"TW"};sn=4,q=6,nt=3,Tr=2,kr=1,Dr=30*1e3,$e=new Map});function ln(e){let t=e.split(".");if(t.length!==4)return null;let n=0;for(let o of t){if(!/^\d{1,3}$/.test(o))return null;let r=Number(o);if(r>255)return null;n=n*256+r}return n>>>0}function _(e){let t=ln(e);if(t===null)return!1;for(let[n,o]of vr){let r=ln(n);if(r===null)continue;let s=o===0?0:4294967295<<32-o>>>0;if((t&s)===(r&s))return!0}return!1}function cn(e){let t=[],n=new Set,o=l=>{let u=`${l.source}|${l.host}|${l.port}`;n.has(u)||(n.add(u),t.push(l))};for(let l of e.proxies??[])l.kind==="direct"?o({source:"proxy",host:l.host,port:l.port,label:__sfx("UHJveHlJUCA=")+l.host+":"+l.port+"",via:{kind:"direct",host:l.host,port:l.port}}):o({source:"proxy",host:l.host,port:l.port,label:`${l.kind.toUpperCase()} ${l.host}:${l.port}`,via:{kind:l.kind,host:l.host,port:l.port,username:l.username,password:l.password,serverName:l.serverName}});let s=_(e.targetHost)||e.deprioritizeDirect===!0;o({source:"direct",host:e.targetHost,port:e.targetPort,label:__sfx("55u06L+eIA==")+e.targetHost+":"+e.targetPort+"",deprioritized:s});let i=e.optimizedIps??[],a=i.filter(l=>!_(l.ip)),c=i.filter(l=>_(l.ip));for(let l of a)o({source:"optimized",host:l.ip,port:l.port,label:__sfx("5LyY6YCJIA==")+l.ip+":"+l.port+""});for(let l of c)o({source:"optimized",host:l.ip,port:l.port,label:__sfx("5LyY6YCJIA==")+l.ip+":"+l.port+__sfx("77yIQ2xvdWRmbGFyZSDnvZHmrrXvvIzlj6/og73kuI3lj6/ovr7vvIk="),deprioritized:!0});let f=e.relay??[];for(let l of f)o({source:"relay",host:l.ip,port:l.port,label:__sfx("5Y+N5LujIA==")+l.label+"",deprioritized:!e.relayAsPrimary});return t.map((l,u)=>({candidate:l,index:u})).sort((l,u)=>{let d=+!!l.candidate.deprioritized-+!!u.candidate.deprioritized;return d!==0?d:l.index-u.index}).map(l=>l.candidate)}function un(e){let t=e.filter(o=>!o.deprioritized),n=t.filter(o=>o.source==="proxy");return{landing:n.filter(o=>o.via?.kind!=="direct"),[__sfx("cHJveHlJcA==")]:n.filter(o=>o.via?.kind==="direct"),direct:t.filter(o=>o.source!=="proxy"),fallback:e.filter(o=>o.deprioritized)}}function fn(e,t){let n=e instanceof Error?e.message:String(e);return Ze(e)?{kind:"policy",message:n,candidate:t}:/proxy request failed|cannot connect to the specified address|TCP Loop/i.test(n)?{kind:"blocked",message:n,candidate:t}:/timeout|超时|timed out|abort/i.test(n)?{kind:"timeout",message:n,candidate:t}:{kind:"other",message:n,candidate:t}}function pn(e){switch(e.kind){case"blocked":return __sfx("5Ye656uZ6KKrIENsb3VkZmxhcmUg5ouS57ud77yI")+e.candidate+"):"+e.message+__sfx("CiAg5bi46KeB5Y6f5Zug77ya55uu5qCH5Zyw5Z2A5ZyoIENsb3VkZmxhcmUg6Ieq5a62572R5q6177yIV29ya2VyIOS4jeiDveS4u+WKqOi/nuWbniBDRiDoh6rlt7HnmoTlhaXlj6PvvInjgIIKICDihpIg5o2i5LiA5Liq56ys5LiJ5pa5IElQ77yM5oiW5pS555So5Luj55CG6JC95Zyw44CC");case"policy":return __sfx("5Ye656uZ6KKr562W55Wl5ouS57ud77yI")+e.candidate+"):"+e.message+__sfx("CiAg55uu5qCH5bGe5LqO546v5ZueIC8g5YaF572RIC8g6ZO+6Lev5pys5ZywIC8g5L+d55WZ5Zyw5Z2A77yMV29ya2VyIOebtOi/nuaXoOazleWIsOi+vuOAggogIOKGkiDopoHorr/pl67lsYDln5/nvZHorr7lpIfvvIzor7fphY3nva7okL3lnLDku6PnkIbvvIjnlLHku6PnkIbkvqflu7rov57vvInjgII=");case"timeout":return __sfx("5Ye656uZ6LaF5pe277yI")+e.candidate+"):"+e.message+__sfx("CiAg4oaSIOivpeWcsOWdgOW9k+WJjeS4jeWPr+i+vu+8jOWPr+aNouS4gOadoeWAmemAieaIluWQr+eUqOS7o+eQhuiQveWcsOOAgg==");default:return __sfx("5Ye656uZ5aSx6LSl77yI")+e.candidate+"):"+e.message+""}}var vr,ot=x(()=>{"use strict";Je();vr=[[__sfx("MTA0LjE2LjAuMA=="),13],[__sfx("MTA0LjI0LjAuMA=="),14],[__sfx("MTA0LjMxLjAuMA=="),15],[__sfx("MTcyLjY0LjAuMA=="),13],[__sfx("MTYyLjE1OC4wLjA="),15],[__sfx("MTg4LjExNC45Ni4w"),20],[__sfx("MTQxLjEwMS42NC4w"),18],[__sfx("MTA4LjE2Mi4xOTIuMA=="),18],[__sfx("MTAzLjIxLjI0NC4w"),22],[__sfx("MTAzLjIyLjIwMC4w"),22],[__sfx("MTAzLjMxLjQuMA=="),22],[__sfx("MTMxLjAuNzIuMA=="),22],[__sfx("MTk3LjIzNC4yNDAuMA=="),22],[__sfx("MTk4LjQxLjEyOC4w"),17],[__sfx("MTkyLjAuMC4w"),24],[__sfx("MTkyLjAuMi4w"),24],[__sfx("MTkyLjg4Ljk5LjA="),24],[__sfx("MTk5LjI3LjEyOC4w"),21],[__sfx("MjIzLjUuNS4w"),24],[__sfx("MS4wLjAuMA=="),24],[__sfx("MS4xLjEuMA=="),24]]});function dn(e,t="direct"){let n=e.trim();if(!n)return null;let o=t,r=n,s=/^([a-z0-9+.-]+):\/\//i.exec(n);if(s){let h=s[1].toLowerCase();r=n.slice(s[0].length),h===__sfx("c29ja3M1")||h===__sfx("c29ja3M=")||h===__sfx("c29ja3M1aA==")?o=__sfx("c29ja3M1"):h==="https"?o="https":h==="http"&&(o="http")}let i=r.lastIndexOf("@"),a={};if(i>=0){let h=r.slice(0,i);r=r.slice(i+1);let y=h.indexOf(":");y>=0?a={username:h.slice(0,y),password:h.slice(y+1)}:a={username:h}}let c,f=/#sni=([^/#]+)/i.exec(r);f&&(c=f[1].trim(),r=r.slice(0,f.index)+r.slice(f.index+f[0].length));let l=r.lastIndexOf(":");if(l<0)return null;let u=r.slice(0,l).replace(/^\[|\]$/g,""),d=Number(r.slice(l+1));return!u||!Number.isInteger(d)||d<=0||d>65535?null:(!c&&o==="https"&&!Lr(u)&&(c=u),{host:u,port:d,kind:o,...a,...c?{serverName:c}:{}})}function Lr(e){return/^\d{1,3}(\.\d{1,3}){3}$/.test(e)}function ce(e,t="direct"){let n=[];for(let o of e.split(/[\n,;]+/)){let r=o.trim();if(!r)continue;let s=dn(r,t);s&&n.push(s)}return n}var st=x(()=>{"use strict"});async function Nr(){return it||(it=(async()=>(await import("cloudflare:sockets")).connect)()),await it}function Or(e,t){if(!O(e))return null;let n=e.split(".").map(i=>Number(i)),o=(n[0]<<8|n[1]).toString(16),r=(n[2]<<8|n[3]).toString(16);return`${t.replace(/:+$/,"")}::${o}:${r}`}async function Pe(e,t,n,o,r){let i=(await Nr())({hostname:e,port:t},o?{secureTransport:o}:void 0),a=async(f,l)=>{let u,d=new Promise((h,y)=>{u=setTimeout(()=>y(new Error(""+l+__sfx("6LaF5pe277ya")+e+":"+t+"")),n)});try{return await Promise.race([f,d])}finally{u&&clearTimeout(u)}},c;try{if(await a(i.opened,__sfx("6L+e5o6l")),o==="starttls"){if(c=i.startTls?.(r?{expectedServerHostname:r}:void 0),!c)throw new Error(__sfx("5b2T5YmN6L+Q6KGM5pe25LiN5pSv5oyBIHN0YXJ0VGxz"));return await a(c.opened,__sfx("VExTIOaPoeaJiw==")),c}return i}catch(f){try{await(c??i).close()}catch{}throw f}}async function Mr(e){let t=e.timeoutMs??ct;try{let n=await Pe(e.hostname,e.port,t);return{readable:n.readable,writable:n.writable,via:"direct",endpoint:`${e.hostname}:${e.port}`,close:()=>{try{n.close()}catch{}}}}catch(n){if(e.nat64&&O(e.hostname)){let o=Or(e.hostname,e.nat64);if(o){let r=await Pe(o,e.port,t);return{readable:r.readable,writable:r.writable,via:"nat64",endpoint:`${o}:${e.port}`,close:()=>{try{r.close()}catch{}}}}}throw n}}async function Br(e,t){let n=e.timeoutMs??ct;if(t.kind==="direct"){let s=await Pe(t.host,t.port,n);return{readable:s.readable,writable:s.writable,via:"direct",endpoint:`${t.host}:${t.port}`,close:()=>{try{s.close()}catch{}}}}let o=t.kind==="https"?"starttls":void 0,r=await Pe(t.host,t.port,n,o,t.kind==="https"?t.serverName:void 0);try{return t.kind==="http"||t.kind==="https"?{readable:await jt(r.readable,r.writable,e.hostname,e.port,{username:t.username,password:t.password}),writable:r.writable,via:t.kind,endpoint:`${t.host}:${t.port}`,close:()=>{try{r.close()}catch{}}}:{readable:await Wt(r.readable,r.writable,e.hostname,e.port,{username:t.username,password:t.password}),writable:r.writable,via:__sfx("c29ja3M1"),endpoint:`${t.host}:${t.port}`,close:()=>{try{r.close()}catch{}}}}catch(s){try{await r.close()}catch{}throw s}}function hn(e){return e instanceof Error?e.message:typeof e=="string"?e:String(e)}function Fr(e){if(e.length===0)return __sfx("5pyq55+l5Y6f5Zug");let t=e.map(hn),n=t.slice(-Hr),o=t.length-n.length;return`${o>0?`\uFF08\u5171 ${t.length} \u6761\uFF0C\u7701\u7565\u524D ${o} \u6761\uFF09`:""}${n.join("\uFF1B")}`}function Gr(e){return e.length===0?Promise.reject(new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"))):new Promise((t,n)=>{let o=e.length,r=!1,s=[];for(let i of e)i().then(a=>{if(r){try{a.writable.getWriter().close()}catch{}return}r=!0,t(a)},a=>{s.push(a),o-=1,o===0&&!r&&(r=!0,n(new Error(__sfx("5pys5om5IA==")+e.length+__sfx("IOS4quWAmemAieWFqOmDqOWksei0pe+8mg==")+Fr(s)+"")))})})}async function lt(e,t){if(e.length===0)throw new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"));if(!t||e.length<=1){let s=new Error(__sfx("5ouo5Y+35aSx6LSl"));for(let i of e)try{return await i()}catch(a){s=a}throw s}let n=[],o=new Error(__sfx("5ouo5Y+35aSx6LSl"));for(let s=0;s<e.length;s+=at){let i=e.slice(s,s+at);try{return await Gr(i)}catch(a){o=a,n.push(hn(a))}}throw new Error(__sfx("5YWo6YOoIA==")+e.length+__sfx("IOS4quWAmemAieWdh+Wksei0pe+8iOWIhiA=")+n.length+__sfx("IOaJue+8jOavj+aJueacgOWkmiA=")+at+__sfx("IOS4quW5tuWPke+8ie+8mgo=")+n.join(`
|
|
4
4
|
`),{cause:o})}async function mn(e,t){let n=[...e];if(!t)return n;try{let o=await ae(t),r=new Set(n.map(s=>`${s.ip}:${s.port}`));for(let s of o){let i=`${s.ip}:${s.port}`;r.has(i)||(r.add(i),n.push(s))}}catch{}return n}async function Kr(e,t,n){if(e.length===0)return null;for(let o=0;o<e.length;o+=q){let s=e.slice(o,o+q).map(i=>t({source:"relay",host:i.ip,port:i.port,label:__sfx("5Y+N5LujIA==")+i.label+""}));try{return await lt(s,n)}catch{}}return null}async function ue(e){let t=e.proxies??[],n=e.concurrent??!0;if(!e.skipTargetPolicy&&t.length===0){let g=Ve(e.hostname);if(g)throw new Q(e.hostname,g)}let o=e.budgetMs??Ir,r=Date.now()+o,s=[...e.optimizedIps??[]],i=!1;if(e.resolvePreferred)try{let g=await Ae(e.hostname,e.port,{deadline:r});if(g.length>0){i=!0;for(let E of g)s.push({ip:E.hostname,port:E.port})}}catch{}let a=_(e.hostname),c=i&&s.length>0&&s.every(g=>_(g.ip)),f=[...e.relay??[]],l=c||a;l&&e.relayPool&&(f=await mn(f,{...e.relayPool,deadline:r}));let u=l?f.slice(0,q):[],d=l?f.slice(q):[],h=cn({targetHost:e.hostname,targetPort:e.port,optimizedIps:s,proxies:t,deprioritizeDirect:a||c,relay:u,relayAsPrimary:u.length>0});if(h.length===0)throw new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Ye656uZ5ouo5Y+35pa55byP"));let y=g=>async()=>{let E=r-Date.now();if(E<=0)throw new Error(__sfx("5ouo5Y+36aKE566X5bey55So5bC977yI")+o+"ms):"+e.hostname+":"+e.port+"");let v=Math.max(200,Math.min(e.timeoutMs??ct,E)),oe={...e,timeoutMs:v};try{if(!e.skipTargetPolicy&&g.source!=="proxy"&&g.source!=="relay"){let M=Ve(g.host);if(M)throw new Q(g.host,M)}return g.source==="proxy"&&g.via?await Br(oe,{host:g.via.host,port:g.via.port,kind:g.via.kind,username:g.via.username,password:g.via.password,serverName:g.via.serverName}):await Mr({...oe,hostname:g.host,port:g.port})}catch(M){let de=fn(M,g.label);throw e.onFailure?.(de),M}},R=un(h),{landing:C,[__sfx("cHJveHlJcA==")]:p,direct:w,fallback:S}=R,I=C.length>0||p.length>0,k=async()=>{if(C.length===0)throw new Error(__sfx("5pyq6YWN572u6JC95Zyw5Luj55CG"));let g;for(let E of C)try{return await y(E)()}catch(v){g=v}throw g??new Error(__sfx("6JC95Zyw5Luj55CG5YWo6YOo5aSx6LSl"))},j=async()=>{if(p.length===0)throw new Error(__sfx("5pyq6YWN572uIFByb3h5SVA="));return await lt(p.map(y),!0)},L=async()=>{let g;if(C.length>0)try{return await k()}catch(E){g=E}if(p.length>0)try{return await j()}catch(E){g=E}throw g??new Error(__sfx("5rKh5pyJ5Y+v55So55qE5Luj55CG"))},J=async()=>await lt(w.map(y),n),X=async()=>{let g=d;return g.length===0&&e.relayPool&&(g=await mn([],{...e.relayPool,deadline:r})),await Kr(g,y,n)},G=async()=>{for(let g of S)try{return await y(g)()}catch{}return null};if(!I)try{return await J()}catch(g){let E=await X();if(E)return E;let v=await G();if(v)return v;throw g}let H=e.proxyMode??"only",re=a||c;if(H==="only")try{return await L()}catch(g){let E=await X();if(E)return E;let v=await G();if(v)return v;throw g}if(H==="global"||H==="smart"&&re)try{return await L()}catch(g){if(H==="global")try{return await J()}catch{}let E=await X();if(E)return E;let v=await G();if(v)return v;throw g}try{return await J()}catch(g){try{return await L()}catch{}let E=await X();if(E)return E;let v=await G();if(v)return v;throw g}}var it,ct,Ir,at,Hr,ut=x(()=>{"use strict";Yt();Xt();Je();z();Qe();le();ot();st();it=null;ct=8e3,Ir=15e3;at=6,Hr=8});async function gn(e,t,n,o=!0,r){let s=e.getReader(),i=t.getWriter();try{for(;!n?.exhausted;){let{done:a,value:c}=await s.read();if(a)break;if(!(!c||c.byteLength===0)){if(r?.(c.byteLength))break;await i.write(c)}}}catch{}finally{if(o)try{await i.close()}catch{}else try{i.releaseLock()}catch{}try{s.releaseLock()}catch{}}}var $,Re=x(()=>{"use strict";$=class{constructor(t){this.limitBytes=t}limitBytes;total=0;get enabled(){return this.limitBytes>0}get bytes(){return this.total}add(t){return this.limitBytes<=0||t<=0?!1:(this.total+=t,this.total>this.limitBytes)}}});var En={};ge(En,{[__sfx("aGFuZGxlV2ViU29ja2V0")]:()=>ke,recentDiagnostics:()=>Yr,recordDiagnostics:()=>ee,truncateCloseReason:()=>Sn});function Sn(e,t=123){let n=new TextEncoder;if(n.encode(e).length<=t)return e;let o=e.slice(0,t);for(;n.encode(o).length>t;)o=o.slice(0,-1);o=o.replace(/\uFFFD+$/,"");let r="\u2026";for(;o.length>0&&n.encode(o+r).length>t;)o=o.slice(0,-1);return o+r}function ee(e,t,n){Te.unshift({at:Date.now(),target:e,failures:t,summary:n}),Te.length>An&&(Te.length=An)}function Yr(){return Te}function Xr(e){if(!e)return new Uint8Array(0);let t=e.trim();if(!t||t.length>16384)return new Uint8Array(0);try{let n=t.replace(/-/g,"+").replace(/_/g,"/"),o=n.length%4===0?"":"=".repeat(4-n.length%4),r=atob(n+o);if(r.length<17||r.length>8192)return new Uint8Array(0);let s=new Uint8Array(r.length);for(let i=0;i<r.length;i++)s[i]=r.charCodeAt(i);return s}catch{return new Uint8Array(0)}}async function ke(e,t,n,o,r,s){let[i,a]=Object.values(new WebSocketPair);try{a.accept({allowHalfOpen:!0})}catch{a.accept()}a.binaryType="arraybuffer";let c=Xr(e.headers.get(__sfx("c2VjLXdlYnNvY2tldC1wcm90b2NvbA=="))),f=!1,l=null,u=null,d=new xe,h=null,y=null,R=!1,C=!1,p=null,w=null,S=m=>{try{a.send(m)}catch{}},I=m=>{let b=new Uint8Array(2+m.byteLength);b[0]=0,b[1]=m.byteLength,b.set(m,2),S(b)},k=(m,b)=>{R=!0;try{a.close(m,Sn(b))}catch{}j()},j=()=>{if(!C){if(C=!0,g(),h&&(clearTimeout(h),h=null),L&&(clearTimeout(L),L=null),y){let m=y;y=null;try{m.cancel()}catch{}}if(l){let m=l.close;if(m)try{m()}catch{}else try{l.writable.close()}catch{}}}},L=null,J=new Set,X=0,G=[],H=0,re=m=>{if(!(m.byteLength===0||M>0)){if(H+m.byteLength>xn){k(1009,__sfx("5pyq56Gu6K6k6YCa6Lev55qE5LiK6KGM5pWw5o2u6L+H5aSa"));return}if(Ce+m.byteLength>Wr){k(1009,__sfx("5a6e5L6L5YaF5a2Y6aKE566X5bey5ruh77yM6K+36YeN6K+V"));return}G.push(m),H+=m.byteLength,Ce+=m.byteLength}},g=()=>{Ce=Math.max(0,Ce-H),G=[],H=0},E=0,v=()=>{E+=1},oe=async()=>{if(!l)return;let m=++E,b=l.readable.getReader();y=b,L&&clearTimeout(L);let P=setTimeout(()=>{L===P&&(L=null),!(M>0)&&H!==0&&(ee(`${p.hostname}:${p.port}`,[],__sfx("55u06L+eIA==")+bn+__sfx("bXMg5peg5LiL6KGM5pWw5o2u77yM5pS56LWw5Y+N5Luj5YWl5Y+j")),Zn())},bn);L=P;try{for(;;){let{done:N,value:D}=await b.read();if(N)break;if(D&&D.byteLength>0){let U=M===0;if(M+=D.byteLength,U&&g(),de.add(D.byteLength)){At();return}S(D)}}}catch{}finally{try{b.releaseLock()}catch{}clearTimeout(P),L===P&&(L=null),y===b&&(y=null),m===E&&!R&&k(1e3,"done")}},M=0,de=new $((n.dataBudgetMB||0)*1024*1024),At=()=>{let m=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+n.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");ee(p?`${p.hostname}:${p.port}`:__sfx("5pyq5bu656uL5Ye656uZ"),[],m),k(1009,m)},St=async m=>{let b=u;if(b)try{await d.write(()=>u===b?b:null,m)}catch{j()}},Yn=async m=>{if(c.byteLength===0)return;let b=c;c=new Uint8Array(0),re(b),await m.write(b)},Et=m=>{if(t===__sfx("dmxlc3M=")){let P=Nt(m,n.uuid);return P?{command:P.header.command,port:P.header.port,hostname:P.header.hostname,headerLength:P.consumed}:null}let b=Ft(m,n[__sfx("dHJvamFuUGFzc3dvcmQ=")]);return b?{command:b.header.command,port:b.header.port,hostname:b.header.hostname,headerLength:b.consumed}:null},jn=()=>{h&&(clearTimeout(h),h=null)},Xn=async()=>{if(!(R||f)){if(Et(c)){await Me();return}k(1008,c.byteLength===0?__sfx("5o+h5omL6LaF5pe277ya5pyq5pS25Yiw5Y2P6K6u5aS0"):__sfx("5o+h5omL6LaF5pe277ya5Y2P6K6u5aS05LiN5a6M5pW05oiW6K6k6K+B5aSx6LSl"))}},Me=async()=>{if(R||f)return;let m=Et(c);if(!m){c.byteLength>0&&!h&&(h=setTimeout(()=>{h=null,Xn().catch(U=>k(1011,String(U)))},jr));return}if(jn(),f)return;f=!0,p=m;let b=t===__sfx("dmxlc3M=")?Ut:Ht;if(m.command===b){if(t===__sfx("dmxlc3M=")&&n.udpDns==="doh"&&m.port===53){I(new Uint8Array(0)),w=new we({endpoint:n.udpDnsEndpoint,send:S});let U=c.subarray(m.headerLength);U.byteLength>0&&w.push(U);return}k(1002,n.udpDns==="doh"?__sfx("VURQIOS7heaUr+aMgSBETlPvvIg1MyDnq6/lj6PvvIk="):__sfx("VURQIOacquWQr+eUqO+8iOmdouadv+WPr+W8gOWQryBETlMgb3ZlciBEb0jvvIk="));return}t===__sfx("dmxlc3M=")&&I(new Uint8Array(0));let P=[],N=null;try{l=await ue({hostname:m.hostname,port:m.port,proxies:o,timeoutMs:yn,concurrent:n.concurrentDial,nat64:n.nat64||void 0,proxyMode:n.proxyMode,resolvePreferred:n.resolvePreferred,relayPool:{userEntries:n.relayPool||void 0,useBuiltin:n.useBuiltinRelay,colo:typeof e.cf?.colo=="string"?e.cf.colo:void 0},onFailure:U=>{P.push(U),s?.failures.push(U)}})}catch(U){N=U}if(!l){let U=P.length>0?P.map(me=>pn(me)).join(`
|
|
5
|
-
`):__sfx("5Ye656uZ6L+e5o6l5aSx6LSl77ya")+String(N)+"";ee(`${m.hostname}:${m.port}`,P,U),k(1011,U);return}u=l.writable.getWriter();let D=c.byteLength>m.headerLength?c.subarray(m.headerLength):new Uint8Array(0);D.byteLength>0&&(re(D),await St(D)),c=new Uint8Array(0),r?.waitUntil(oe())},Zn=async()=>{let m=p;if(!m){k(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55uu5qCH5pyq6Kej5p6Q"));return}if(X>=wn){k(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55u06L+e5LiO5Y+N5Luj5YWl5Y+j5Z2H5peg5ZON5bqU"));return}X++;let b=[];try{b=await ae({userEntries:n.relayPool||void 0,useBuiltin:n.useBuiltinRelay,colo:typeof e.cf?.colo=="string"?e.cf.colo:void 0})}catch{b=[]}let P=b.filter(N=>!J.has(`${N.ip}:${N.port}`));if(P.length===0){k(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5peg5Y+N5Luj5YWl5Y+j5Y+v55So"));return}for(let N of P.slice(0,wn)){if(J.add(`${N.ip}:${N.port}`),v(),l){let D=l;if(D.close)try{D.close()}catch{}}u=null,M=0;try{let D=await ue({hostname:N.ip,port:N.port,timeoutMs:yn,resolvePreferred:!1,skipTargetPolicy:!0});if(!D)continue;l=D;let U=D.writable.getWriter();u=U;let me=0;for(let he of G)me+=he.byteLength;let Be=new Uint8Array(me),Rt=0;for(let he of G)Be.set(he,Rt),Rt+=he.byteLength;await d.run(async()=>{Be.byteLength>0&&await U.write(Be),await Yn(U)}),ee(`${m.hostname}:${m.port}`,[],__sfx("5bey5YiH5o2i5Y+N5Luj5YWl5Y+jIA==")+N.ip+":"+N.port+""),r?.waitUntil(oe());return}catch(D){ee(`${m.hostname}:${m.port}`,[],__sfx("5Y+N5Luj5YWl5Y+jIA==")+N.ip+":"+N.port+__sfx("IOWksei0pe+8mg==")+String(D)+"")}}k(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5omA5pyJ5Y+N5Luj5YWl5Y+j5Z2H5aSx6LSl"))};a.addEventListener("message",m=>{(async()=>{let b=m.data,P=typeof b=="string"?new TextEncoder().encode(b):new Uint8Array(b);if(P.byteLength!==0){if(de.add(P.byteLength)){At();return}if(!f){if(c=je(c,P),c.byteLength>zr){k(1009,__sfx("5o+h5omL5aS06LaF6L+HIDY0S0I="));return}await Me();return}if(w){w.push(P);return}if(!u){if(c=je(c,P),c.byteLength>xn){k(1009,__sfx("5ouo5Y+35pyf6Ze05pWw5o2u6L+H5aSa"));return}return}re(P),await St(P)}})()});let Pt=()=>{j()};a.addEventListener("close",Pt),a.addEventListener("error",Pt),c.byteLength>0&&Me().catch(m=>k(1011,String(m)));try{return new Response(null,{status:101,[__sfx("d2ViU29ja2V0")]:i})}catch(m){return console.error(__sfx("W+iHqueglOaVsOaNrumdol0gMTAxIOWTjeW6lOaehOmAoOWksei0pe+8mg=="),m),new Response(null,{status:200})}}var yn,bn,wn,zr,xn,Wr,Ce,Te,An,jr,ft=x(()=>{"use strict";We();Gt();Kt();ie();zt();ut();Re();ot();le();yn=5e3,bn=2500,wn=2,zr=64*1024,xn=8*1024*1024,Wr=32*1024*1024,Ce=0;Te=[],An=20;jr=2e3});var Pn={};ge(Pn,{[__sfx("aGFuZGxlWGh0dHA=")]:()=>pt,[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:()=>Jr,[__sfx("cmVjb3JkWGh0dHBEaWFnbm9zdGljcw==")]:()=>Ue});function Vr(e,t){return new Promise(n=>{let o=setTimeout(()=>n(null),t);e.then(r=>{clearTimeout(o),n(r)},()=>{clearTimeout(o),n(null)})})}function Ue(e,t,n){De.unshift({at:Date.now(),target:e,...t,summary:n}),De.length>20&&(De.length=20)}function Jr(){return De}async function pt(e,t,n){let o=e.body;if(!o)return new Response(__sfx("57y65bCR6K+35rGC5L2T"),{status:400});let r=new W(o),s=await Vr(Lt(r,t.uuid),Zr);if(!s)return await r.cancel("header timeout"),new Response(__sfx("VkxFU1Mg5aS06Kej5p6Q5aSx6LSl"),{status:400});if(s.header.command!==Dt)return await s.payload.cancel("unsupported UDP"),new Response(__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),{status:400});let i;try{i=await ue({hostname:s.header.hostname,port:s.header.port,proxies:n,nat64:t.nat64,concurrent:t.concurrentDial,proxyMode:t.proxyMode,resolvePreferred:t.resolvePreferred,relayPool:{userEntries:t.relayPool||void 0,useBuiltin:t.useBuiltinRelay},onFailure:p=>{Ue(`${s.header.hostname}:${s.header.port}`,p,__sfx("WEhUVFAg5Ye656uZ5aSx6LSl77yI")+p.candidate+"):"+p.message+"")}})}catch(p){Ue(`${s.header.hostname}:${s.header.port}`,{kind:"dial",message:String(p),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5YWo6YOo5aSx6LSl77ya")+String(p)+"");try{s.payload.cancel("dial failed").catch(()=>{})}catch{}return new Response(__sfx("5Ye656uZ5LiN5Y+v55So"),{status:502})}let a=s.header.addons;if(a.byteLength>255)return new Response(__sfx("QWRkb25zIOmVv+W6pui2heWHuiBWTEVTUyDljY/orq7kuIrpmZA="),{status:400});let c=new Uint8Array(2+a.byteLength);c[0]=s.header.version,c[1]=a.byteLength,c.set(a,2);let f=!1,l=null,u=!1,d=new $((t.dataBudgetMB||0)*1024*1024),h=null,y=()=>{if(u)return;u=!0;let p=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+t.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");if(Ue(`${s.header.hostname}:${s.header.port}`,{kind:"budget",message:p,candidate:"traffic"},p),i.close)try{i.close()}catch{}try{h?.close()}catch{}},R=p=>d.add(p)?(y(),!0):!1;gn(s.payload,i.writable,void 0,!1,R).catch(()=>{});let C=new ReadableStream({start(p){h=p,p.enqueue(c),f=!0},async pull(p){if(!(u||!f)){l||(l=i.readable.getReader());try{let{done:w,value:S}=await l.read();if(u)return;if(w){if(i.close)try{i.close()}catch{}p.close();return}if(S&&S.byteLength>0){if(d.add(S.byteLength)){y();return}p.enqueue(S)}}catch(w){if(u)return;if(i.close)try{i.close()}catch{}try{p.error(w)}catch{}}}},cancel(p){u=!0;try{i.readable.cancel(p)}catch{}if(i.close)try{i.close()}catch{}}});return new Response(C,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-store","X-Accel-Buffering":"no"}})}var Zr,De,dt=x(()=>{"use strict";ie();We();Re();ut();Zr=2e3;De=[]});function Le(){return new Response(JSON.stringify({build:mt,version:Qr,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var mt,Qr,ve,ht=x(()=>{"use strict";mt="00082f0-6a8a5b51",Qr=__sfx("MC4xMy45"),ve=__sfx("L19fY2ZwX3ZlcnNpb24=")});function Rn(e){return e[__sfx("S1Y=")]?new te(e[__sfx("S1Y=")]):new gt}var te,gt,Ne=x(()=>{"use strict";te=class{constructor(t){this.kv=t}kv;async get(t){return await this.kv.get(t)}async put(t,n,o){o&&o>=60?await this.kv.put(t,n,{expirationTtl:o}):await this.kv.put(t,n)}async delete(t){await this.kv.delete(t)}async list(t){let n=[],o;do{let r=await this.kv.list({prefix:t,cursor:o});for(let s of r.keys)n.push(s.name);o=r.list_complete?void 0:r.cursor}while(o);return n}},gt=class{data=new Map;async get(t){let n=this.data.get(t);return n?n.expiresAt>0&&n.expiresAt<=Date.now()?(this.data.delete(t),null):n.value:null}async put(t,n,o){let r=o?Date.now()+o*1e3:0;this.data.set(t,{value:n,expiresAt:r})}async delete(t){this.data.delete(t)}async list(t){return[...this.data.keys()].filter(n=>n.startsWith(t))}}});function V(e,t){if(e==null)return t;let n=String(e).trim();if(n==="")return t;let o=Number(n);return Number.isFinite(o)?o:t}function B(e,t){if(e==null||e==="")return t;let n=String(e).trim().toLowerCase();return["1","true","yes","on"].includes(n)?!0:["0","false","no","off"].includes(n)?!1:t}function qr(e){let t=e.trim().toLowerCase();return t==="global"||t==="fallback"||t==="smart"?t:"only"}function Tn(e){return e.trim().toLowerCase()==="signed"?"signed":"legacy"}function kn(e){return e.trim().toLowerCase()==="doh"?"doh":"off"}function T(e,t){return e==null?t:String(e)}function _r(e){return{uuid:T(e[__sfx("VVVJRA==")],""),[__sfx("dHJvamFuUGFzc3dvcmQ=")]:T(e[__sfx("VFJPSkFOX1BBU1NXT1JE")],""),wsPath:T(e[__sfx("V1NfUEFUSA==")]||e[__sfx("UEFUSA==")],A.wsPath),[__sfx("dHJvamFuUGF0aA==")]:A[__sfx("dHJvamFuUGF0aA==")],[__sfx("eGh0dHBQYXRo")]:A[__sfx("eGh0dHBQYXRo")],add:T(e[__sfx("QURE")],""),addApi:T(e[__sfx("QUREQVBJ")],""),addCsv:T(e[__sfx("QUREX0NTVg==")],""),poolOfficial:B(e[__sfx("T0ZGSUNJQUxfSVA=")],A.poolOfficial),officialCount:V(e[__sfx("T0ZGSUNJQUxfSVBfQ09VTlQ=")],A.officialCount),poolDomain:B(e[__sfx("UFJFRkVSUkVEX0RPTUFJTg==")],A.poolDomain),domainCount:V(e[__sfx("UFJFRkVSUkVEX0RPTUFJTl9DT1VOVA==")],A.domainCount),poolManual:B(e[__sfx("TUFOVUFMX0lQ")],A.poolManual),poolCountries:T(e[__sfx("UE9PTF9DT1VOVFJJRVM=")],A.poolCountries),dls:V(e[__sfx("RExT")],0),maxLatency:V(e[__sfx("TUFYX0xBVEVOQ1k=")],0),maxNodes:0,[__sfx("cHJveHlJcA==")]:T(e[__sfx("UFJPWFlJUA==")],""),[__sfx("c29ja3M1")]:T(e[__sfx("U09DS1M1")],""),httpProxy:T(e[__sfx("SFRUUF9QUk9YWQ==")],""),proxyMode:qr(T(e[__sfx("UFJPWFlfTU9ERQ==")],"")),nat64:T(e[__sfx("TkFUNjQ=")],""),concurrentDial:B(e[__sfx("VENQX0NPTkNVUlJFTlRfRElBTA==")],!0),dataBudgetMB:V(e[__sfx("REFUQV9CVURHRVRfTUI=")],A.dataBudgetMB),resolvePreferred:B(e[__sfx("UkVTT0xWRV9QUkVGRVJSRUQ=")],A.resolvePreferred),relayPool:T(e[__sfx("UkVMQVlfUE9PTA==")],""),useBuiltinRelay:B(e[__sfx("VVNFX0JVSUxUSU5fUkVMQVk=")],A.useBuiltinRelay),[__sfx("ZW5hYmxlVHJvamFu")]:B(e[__sfx("RU5BQkxFX1RST0pBTg==")]??e[__sfx("VFJPSkFO")],A[__sfx("ZW5hYmxlVHJvamFu")]),[__sfx("ZW5hYmxlWGh0dHA=")]:B(e[__sfx("RU5BQkxFX1hIVFRQ")]??e[__sfx("WEhUVFA=")],A[__sfx("ZW5hYmxlWGh0dHA=")]),subDomain:"",subProtocol:"both",subTransport:"both",subVariants:T(e[__sfx("U1VCX1ZBUklBTlRT")],A.subVariants),subName:T(e[__sfx("U1VCX05BTUU=")],A.subName).trim()||A.subName,subPorts:T(e[__sfx("U1VCX1BPUlRT")],A.subPorts),clientFingerprint:A.clientFingerprint,ech:B(e[__sfx("RUNI")],A.ech),echHost:T(e[__sfx("RUNIX0hPU1Q=")],A.echHost),echDns:T(e[__sfx("RUNIX0ROUw==")],A.echDns),tlsFragment:!1,tlsFragmentSize:A.tlsFragmentSize,tlsFragmentDelay:A.tlsFragmentDelay,subToken:Tn(T(e[__sfx("U1VCX1RPS0VOX01PREU=")],"")),subTokenTtlDays:V(e[__sfx("U1VCX1RPS0VOX1RUTF9EQVlT")],A.subTokenTtlDays),unlockProbe:B(e[__sfx("VU5MT0NLX1BST0JF")],A.unlockProbe),udpDns:kn(T(e[__sfx("VURQX0ROUw==")],"")),udpDnsEndpoint:T(e[__sfx("VURQX0ROU19FTkRQT0lOVA==")],A.udpDnsEndpoint)}}function $r(e,t){let n={...e};for(let[o,r]of Object.entries(t))if(r!=null)if(o==="dls"||o==="maxLatency"||o==="maxNodes"||o==="officialCount"||o==="domainCount"||o==="dataBudgetMB"||o==="subTokenTtlDays")n[o]=V(r,0);else if(o==="concurrentDial"||o==="resolvePreferred"||o==="useBuiltinRelay"||o===__sfx("ZW5hYmxlVHJvamFu")||o===__sfx("ZW5hYmxlWGh0dHA=")||o==="tlsFragment"||o==="ech"||o==="poolOfficial"||o==="poolDomain"||o==="poolManual"||o==="unlockProbe")n[o]=B(r,!1);else if(o==="subProtocol"){let s=String(r);n[o]=s===__sfx("dmxlc3M=")||s===__sfx("dHJvamFu")||s==="both"?s:"both"}else if(o==="subTransport"){let s=String(r);n[o]=s==="ws"||s===__sfx("eGh0dHA=")||s==="both"?s:"both"}else o==="subToken"?n[o]=Tn(String(r)):o==="udpDns"?n[o]=kn(String(r)):n[o]=String(r);return n}async function Dn(e,t){let n=_r(t),o=await e.get(Cn),r={};if(o)try{r=JSON.parse(o)}catch{r={}}let s=$r(n,r),i=!1,a=e instanceof te;return!s.uuid&&a&&(s.uuid=He(),i=!0),!s[__sfx("dHJvamFuUGFzc3dvcmQ=")]&&a&&(s[__sfx("dHJvamFuUGFzc3dvcmQ=")]=He().replace(/-/g,"").slice(0,16),i=!0),s.officialCount<1&&(s.officialCount=A.officialCount,i=!0),s.domainCount<1&&(s.domainCount=A.domainCount,i=!0),i&&await eo(e,s),s}async function eo(e,t){await e.put(Cn,JSON.stringify(t))}var Cn,A,Ie=x(()=>{"use strict";K();Ne();Cn="CONFIG",A={uuid:"",[__sfx("dHJvamFuUGFzc3dvcmQ=")]:"",wsPath:__sfx("L3ZsZXNz"),[__sfx("dHJvamFuUGF0aA==")]:__sfx("L3Ryb2phbg=="),[__sfx("eGh0dHBQYXRo")]:__sfx("L3hodHRw"),add:"",addApi:"",addCsv:"",poolOfficial:!0,officialCount:20,poolDomain:!0,domainCount:10,poolManual:!0,poolCountries:"",dls:0,maxLatency:0,maxNodes:0,[__sfx("cHJveHlJcA==")]:"",[__sfx("c29ja3M1")]:"",httpProxy:"",proxyMode:"only",nat64:"",concurrentDial:!0,dataBudgetMB:0,resolvePreferred:!0,relayPool:"",useBuiltinRelay:!0,[__sfx("ZW5hYmxlVHJvamFu")]:!0,[__sfx("ZW5hYmxlWGh0dHA=")]:!0,subDomain:"",subProtocol:__sfx("dmxlc3M="),subTransport:"ws",subVariants:__sfx("dmxlc3Mtd3M="),subName:__sfx("Q0ZQaWxvdA=="),subPorts:"443",clientFingerprint:"chrome",ech:!1,echHost:__sfx("Y2xvdWRmbGFyZS1lY2guY29t"),echDns:"",tlsFragment:!1,tlsFragmentSize:"10-20",tlsFragmentDelay:"10-20",subToken:"legacy",subTokenTtlDays:0,unlockProbe:!1,udpDns:"off",udpDnsEndpoint:"https://dns.google/dns-query"}});var Un,to,ys,no,bs,vn=x(()=>{"use strict";Un={[__sfx("SEs=")]:["HKG"],[__sfx("VFc=")]:["TPE","KHH"],[__sfx("SlA=")]:["NRT","KIX","CTS","FUK"],[__sfx("S1I=")]:["ICN","PUS"],[__sfx("U0c=")]:["SIN"],[__sfx("TVk=")]:["KUL"],[__sfx("VEg=")]:["BKK"],[__sfx("Vk4=")]:["SGN","HAN"],[__sfx("SUQ=")]:["CGK","DPS"],[__sfx("UEg=")]:["MNL"],[__sfx("SU4=")]:["BOM","MAA","DEL"],[__sfx("QVU=")]:["SYD","MEL","BNE","PER"],[__sfx("Tlo=")]:["AKL"],[__sfx("VVM=")]:["LAX","SJC","SEA","ORD","DFW","IAD","EWR","ATL","MIA","DEN","PHX","BOS"],[__sfx("Q0E=")]:["YYZ","YVR","YYC"],[__sfx("R0I=")]:["LHR","MAN"],[__sfx("REU=")]:["FRA","MUC","BER"],[__sfx("RlI=")]:["CDG","MRS"],[__sfx("Tkw=")]:["AMS"],[__sfx("SVQ=")]:["MXP","FCO"],[__sfx("RVM=")]:["MAD","BCN"],[__sfx("U0U=")]:["ARN"],[__sfx("Q0g=")]:["ZRH"],[__sfx("QVQ=")]:["VIE"],[__sfx("UEw=")]:["WAW"],[__sfx("UlU=")]:["DME","SVO"],[__sfx("VFI=")]:["IST"],[__sfx("QUU=")]:["DXB"],[__sfx("SUw=")]:["TLV"],[__sfx("WkE=")]:["JNB"],[__sfx("QlI=")]:["GRU","GIG"],[__sfx("QVI=")]:["EZE"],[__sfx("Q0w=")]:["SCL"],[__sfx("TVg=")]:["MEX"]},to=__sfx("SEtH6aaZ5rivLFRQReWPsOWMlyxOUlTkuJzkuqwsS0lY5aSn6ZiqLElDTummluWwlCxTSU7mlrDliqDlnaEsS1VM5ZCJ6ZqG5Z2hLEJLS+abvOiwtyxTR07og6Hlv5fmmI7luIIsTU5M6ams5bC85ouJLFNZROaCieWwvCxNRUzloqjlsJTmnKwsTEFY5rSb5p2J55+2LFNKQ+Wco+S9leWhnixTRUHopb/pm4Xlm74sT1JE6Iqd5Yqg5ZOlLElBROWNjuebm+mhvyxFV1Lnur3nk6blhYssWVla5aSa5Lym5aSaLFlWUua4qeWTpeWNjixMSFLkvKbmlaYsRlJB5rOV5YWw5YWL56aPLENER+W3tOm7jixBTVPpmL/lp4bmlq/nibnkuLksTUFE6ams5b636YeMLEFSTuaWr+W+t+WTpeWwlOaRqSxJU1TkvIrmlq/lnabluIPlsJQsRFhC6L+q5ouc"),ys=(()=>{let e={};for(let t of to.split(","))t.length>3&&(e[t.slice(0,3)]=t.slice(3));return e})(),no=new Map;for(let[e,t]of Object.entries(Un))for(let n of t)no.set(n,e);bs=Object.keys(Un)});var Ln=x(()=>{"use strict"});var Is,Nn=x(()=>{"use strict";z();K();vn();Ln();Is=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});var Hs,In=x(()=>{"use strict";Ne();K();Hs=new TextEncoder});var ti,On=x(()=>{"use strict";Ie();K();ti=3600*24});function Mn(e){return Rn(e)}async function Bn(e,t){if(fe.config&&Date.now()-fe.configAt<ro)return fe.config;let n=await Dn(e,t);return fe.config=n,fe.configAt=Date.now(),n}var ro,fe,bt=x(()=>{"use strict";Ne();Ie();On();ro=15e3,fe={config:null,configAt:0,auth:null,authAt:0}});var Fn={};ge(Fn,{clearUnlockCache:()=>po,runUnlockProbe:()=>fo});function co(e,t,n){return e===200?"ok":e===404?t==="status"?"region":"unknown":e===403||e===451?"blocked":t==="trace"&&/\bloc=[A-Z]{2}\b/.test(n)?"ok":"unknown"}async function uo(e){let t=Date.now(),n=new AbortController,o=setTimeout(()=>n.abort(),io);try{let r=await fetch(e.url,{method:"GET",redirect:"manual",signal:n.signal,headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,*/*"}}),s="";e.mode==="trace"&&(s=(await r.text()).slice(0,512));let i=/\bloc=([A-Z]{2})\b/.exec(s)?.[1];return{id:e.id,status:r.status,verdict:co(r.status,e.mode,s),ms:Date.now()-t,...i?{loc:i}:{}}}catch(r){let s=r instanceof Error?r.message:String(r);return{id:e.id,status:0,verdict:"unknown",ms:Date.now()-t,error:/abort/i.test(s)?"timeout":"fetch-failed"}}finally{clearTimeout(o)}}async function fo(e,t){let n=e||"UNK",o=Date.now(),r=ne.get(n);if(r&&o-r.at<ao)return{...r.data,cached:!0};let s=await Promise.all(so.map(a=>uo(a))),i={colo:n,region:t,cached:!1,at:o,targets:s};if(ne.size>=lo){let a="",c=Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")];for(let[f,l]of ne)l.at<c&&(c=l.at,a=f);a&&ne.delete(a)}return ne.set(n,{at:o,data:i}),i}function po(){ne.clear()}var so,io,ao,lo,ne,Gn=x(()=>{"use strict";so=[{id:"netflix",url:"https://www.netflix.com/title/81215567",mode:"status"},{id:"youtube",url:"https://www.youtube.com/premium",mode:"status"},{id:"gemini",url:"https://gemini.google.com/",mode:"status"}],io=4e3,ao=600*1e3,lo=16,ne=new Map});K();var Jn=8*1024*1024,Qn=2*1024*1024,Tt=600*1e3,qn=6*1024*1024*1024,Fe=Date.now(),Ge=0;function kt(e){e-Fe>=Tt&&(Fe=e,Ge=0)}function _n(e,t=Date.now()){kt(t),Ge+=e}function Ct(e){return kt(e),qn-Ge}var $n=(()=>{let e=new Uint8Array(65536),t=2654435769;for(let n=0;n<e.length;n++)t^=t<<13,t^=t>>>17,t^=t<<5,e[n]=t&255;return e})(),er=5e3;function tr(e,t=er){let n=!1,o=setTimeout(()=>{if(!n){n=!0;try{e(1e3,"Probe idle timeout")}catch{}}},t),r=o;return typeof r?.unref=="function"&&r.unref(),{cancel:()=>{n||(n=!0,clearTimeout(o))}}}async function Ke(e){let t=new URL(e.url);if(e.headers.get("Upgrade")?.toLowerCase()===__sfx("d2Vic29ja2V0")){let f=new WebSocketPair,[l,u]=Object.values(f);u.accept();let d=tr((h,y)=>u.close(h,y));return u.addEventListener("message",h=>{let y=typeof h.data=="string"?h.data:"";if(y==="PING"||y==="ping"){d.cancel(),u.send(JSON.stringify({pong:!0,colo:e.cf?.colo??"UNK",clientIp:e.headers.get("CF-Connecting-IP")??""}));try{u.close(1e3,"Probe complete")}catch{}return}d.cancel();try{u.close(1e3,"Probe aborted")}catch{}}),u.addEventListener("close",()=>d.cancel()),u.addEventListener("error",()=>d.cancel()),new Response(null,{status:101,[__sfx("d2ViU29ja2V0")]:l})}let o=Number.parseInt(t.searchParams.get("bytes")??"",10),r=Number.isFinite(o)&&o>0?Math.min(o,Jn):Qn,s=Date.now();if(Ct(s)<=0){let f=Math.max(1e3,Fe+Tt-s);return new Response(JSON.stringify({ok:!1,error:"probe budget exhausted"}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(f/1e3))}})}let i=$n,a=0,c=new ReadableStream({pull(f){let l=Ct(Date.now());if(a>=r||l<=0){f.close();return}let u=Math.min(i.byteLength,r-a,l);f.enqueue(i.subarray(0,u)),a+=u,_n(u)}});return new Response(c,{status:200,headers:{"Content-Type":"application/octet-stream","Content-Encoding":"identity","Cache-Control":"no-store","Access-Control-Allow-Origin":"*","X-Probe-Bytes":String(r),"X-Probe-Nonce":be(4)}})}ft();dt();st();ht();K();Ie();Re();Nn();In();K();function yt(e){let t=e===200?"Welcome":e===404?"Not Found":"Service Unavailable",n=`<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${t}</title><style>body{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;background:#f7f8fa;color:#333;font-family:-apple-system,"Segoe UI","PingFang SC",sans-serif}.c{text-align:center}h1{font-size:22px;font-weight:600;margin:0 0 10px}p{color:#888;font-size:14px;margin:0}</style></head><body><div class="c"><h1>${t}</h1><p>This site is up and running.</p></div></body></html>`;return new Response(n,{status:e,headers:{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store","X-Content-Type-Options":"nosniff"}})}bt();bt();async function Hn(e){let t=Mn(e);return await Bn(t,e)}function wt(e){let t=[];return t.push(...ce(e[__sfx("cHJveHlJcA==")],"direct")),t.push(...ce(e[__sfx("c29ja3M1")],__sfx("c29ja3M1"))),t.push(...ce(e.httpProxy,"http")),t}var xt=6e4,mo=10,pe=0,Oe=0;function Kn(e){return e>=Oe?(pe=0,Oe=e+xt,!1):pe>=mo}function zn(e,t,n){if(!n)return!1;let o=(e.headers.get(__sfx("eC1jZnBpbG90LXRva2Vu"))??t.searchParams.get("token")??"").trim();if(!o)return!1;let r=Date.now();return se(o,n)?(pe=0,!0):(r>=Oe&&(Oe=r+xt,pe=0),pe+=1,!1)}async function Wn(e,t,n){let o=new URL(e.url);if(o.pathname===__sfx("L19fZWRnZV9wcm9iZQ=="))return Ke(e);if(o.pathname===ve||o.pathname===__sfx("L19fdmVyc2lvbg=="))return Le();if(o.pathname==="/region"&&e.method==="GET"){let{coloToCountry:i,rankRegions:a}=await Promise.resolve().then(()=>(le(),rt)),c=e.cf?.colo??"",f=c?i(c):"";return new Response(JSON.stringify({ok:!0,colo:c,region:f,relayPreference:f?a(f):[],timestamp:new Date().toISOString()},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8"}})}let r=await Hn(t);if(o.pathname===__sfx("L19fZGlhZw==")){if(Kn(Date.now()))return new Response(JSON.stringify({ok:!1,error:"token attempts throttled"},null,2),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(xt/1e3))}});if(!zn(e,o,r.uuid))return null;let{recentDiagnostics:i}=await Promise.resolve().then(()=>(ft(),En)),{[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:a}=await Promise.resolve().then(()=>(dt(),Pn));return new Response(JSON.stringify({ok:!0,impl:"self",build:mt,recent:i(),[__sfx("eGh0dHA=")]:a()},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}if(o.pathname==="/__unlock_probe"){if(!r.unlockProbe)return null;if(Kn(Date.now()))return new Response(JSON.stringify({ok:!1,error:"token attempts throttled"},null,2),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}});if(!zn(e,o,r.uuid))return null;let{coloToCountry:i}=await Promise.resolve().then(()=>(le(),rt)),{runUnlockProbe:a}=await Promise.resolve().then(()=>(Gn(),Fn)),c=e.cf?.colo??"",f=c?i(c):"",l=await a(c,f);return new Response(JSON.stringify({ok:!0,...l},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}let s=e.headers.get("Upgrade")?.toLowerCase();return o.pathname===r.wsPath?s!==__sfx("d2Vic29ja2V0")?null:await ke(e,__sfx("dmxlc3M="),r,wt(r),n):r[__sfx("ZW5hYmxlVHJvamFu")]&&o.pathname===r[__sfx("dHJvamFuUGF0aA==")]?s!==__sfx("d2Vic29ja2V0")?null:await ke(e,__sfx("dHJvamFu"),r,wt(r),n):r[__sfx("ZW5hYmxlWGh0dHA=")]&&o.pathname===r[__sfx("eGh0dHBQYXRo")]?e.method!=="POST"?null:await pt(e,r,wt(r)):null}ht();var Zi={async fetch(e,t,n){try{return new URL(e.url).pathname===ve?Le():await Wn(e,t,n)??yt(200)}catch{return yt(500)}}};export{Zi as default};
|
|
5
|
+
`):__sfx("5Ye656uZ6L+e5o6l5aSx6LSl77ya")+String(N)+"";ee(`${m.hostname}:${m.port}`,P,U),k(1011,U);return}u=l.writable.getWriter();let D=c.byteLength>m.headerLength?c.subarray(m.headerLength):new Uint8Array(0);D.byteLength>0&&(re(D),await St(D)),c=new Uint8Array(0),r?.waitUntil(oe())},Zn=async()=>{let m=p;if(!m){k(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55uu5qCH5pyq6Kej5p6Q"));return}if(X>=wn){k(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya55u06L+e5LiO5Y+N5Luj5YWl5Y+j5Z2H5peg5ZON5bqU"));return}X++;let b=[];try{b=await ae({userEntries:n.relayPool||void 0,useBuiltin:n.useBuiltinRelay,colo:typeof e.cf?.colo=="string"?e.cf.colo:void 0})}catch{b=[]}let P=b.filter(N=>!J.has(`${N.ip}:${N.port}`));if(P.length===0){k(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5peg5Y+N5Luj5YWl5Y+j5Y+v55So"));return}for(let N of P.slice(0,wn)){if(J.add(`${N.ip}:${N.port}`),v(),l){let D=l;if(D.close)try{D.close()}catch{}}u=null,M=0;try{let D=await ue({hostname:N.ip,port:N.port,timeoutMs:yn,resolvePreferred:!1,skipTargetPolicy:!0});if(!D)continue;l=D;let U=D.writable.getWriter();u=U;let me=0;for(let he of G)me+=he.byteLength;let Be=new Uint8Array(me),Rt=0;for(let he of G)Be.set(he,Rt),Rt+=he.byteLength;await d.run(async()=>{Be.byteLength>0&&await U.write(Be),await Yn(U)}),ee(`${m.hostname}:${m.port}`,[],__sfx("5bey5YiH5o2i5Y+N5Luj5YWl5Y+jIA==")+N.ip+":"+N.port+""),r?.waitUntil(oe());return}catch(D){ee(`${m.hostname}:${m.port}`,[],__sfx("5Y+N5Luj5YWl5Y+jIA==")+N.ip+":"+N.port+__sfx("IOWksei0pe+8mg==")+String(D)+"")}}k(1011,__sfx("5Ye656uZ5peg5pWw5o2u77ya5omA5pyJ5Y+N5Luj5YWl5Y+j5Z2H5aSx6LSl"))};a.addEventListener("message",m=>{(async()=>{let b=m.data,P=typeof b=="string"?new TextEncoder().encode(b):new Uint8Array(b);if(P.byteLength!==0){if(de.add(P.byteLength)){At();return}if(!f){if(c=je(c,P),c.byteLength>zr){k(1009,__sfx("5o+h5omL5aS06LaF6L+HIDY0S0I="));return}await Me();return}if(w){w.push(P);return}if(!u){if(c=je(c,P),c.byteLength>xn){k(1009,__sfx("5ouo5Y+35pyf6Ze05pWw5o2u6L+H5aSa"));return}return}re(P),await St(P)}})()});let Pt=()=>{j()};a.addEventListener("close",Pt),a.addEventListener("error",Pt),c.byteLength>0&&Me().catch(m=>k(1011,String(m)));try{return new Response(null,{status:101,[__sfx("d2ViU29ja2V0")]:i})}catch(m){return console.error(__sfx("W+iHqueglOaVsOaNrumdol0gMTAxIOWTjeW6lOaehOmAoOWksei0pe+8mg=="),m),new Response(null,{status:200})}}var yn,bn,wn,zr,xn,Wr,Ce,Te,An,jr,ft=x(()=>{"use strict";We();Gt();Kt();ie();zt();ut();Re();ot();le();yn=5e3,bn=2500,wn=2,zr=64*1024,xn=8*1024*1024,Wr=32*1024*1024,Ce=0;Te=[],An=20;jr=2e3});var Pn={};ge(Pn,{[__sfx("aGFuZGxlWGh0dHA=")]:()=>pt,[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:()=>Jr,[__sfx("cmVjb3JkWGh0dHBEaWFnbm9zdGljcw==")]:()=>Ue});function Vr(e,t){return new Promise(n=>{let o=setTimeout(()=>n(null),t);e.then(r=>{clearTimeout(o),n(r)},()=>{clearTimeout(o),n(null)})})}function Ue(e,t,n){De.unshift({at:Date.now(),target:e,...t,summary:n}),De.length>20&&(De.length=20)}function Jr(){return De}async function pt(e,t,n){let o=e.body;if(!o)return new Response(__sfx("57y65bCR6K+35rGC5L2T"),{status:400});let r=new W(o),s=await Vr(Lt(r,t.uuid),Zr);if(!s)return await r.cancel("header timeout"),new Response(__sfx("VkxFU1Mg5aS06Kej5p6Q5aSx6LSl"),{status:400});if(s.header.command!==Dt)return await s.payload.cancel("unsupported UDP"),new Response(__sfx("WEhUVFAg5pqC5LiN5pSv5oyBIFVEUA=="),{status:400});let i;try{i=await ue({hostname:s.header.hostname,port:s.header.port,proxies:n,nat64:t.nat64,concurrent:t.concurrentDial,proxyMode:t.proxyMode,resolvePreferred:t.resolvePreferred,relayPool:{userEntries:t.relayPool||void 0,useBuiltin:t.useBuiltinRelay},onFailure:p=>{Ue(`${s.header.hostname}:${s.header.port}`,p,__sfx("WEhUVFAg5Ye656uZ5aSx6LSl77yI")+p.candidate+"):"+p.message+"")}})}catch(p){Ue(`${s.header.hostname}:${s.header.port}`,{kind:"dial",message:String(p),candidate:"all"},__sfx("WEhUVFAg5Ye656uZ5YWo6YOo5aSx6LSl77ya")+String(p)+"");try{s.payload.cancel("dial failed").catch(()=>{})}catch{}return new Response(__sfx("5Ye656uZ5LiN5Y+v55So"),{status:502})}let a=s.header.addons;if(a.byteLength>255)return new Response(__sfx("QWRkb25zIOmVv+W6pui2heWHuiBWTEVTUyDljY/orq7kuIrpmZA="),{status:400});let c=new Uint8Array(2+a.byteLength);c[0]=s.header.version,c[1]=a.byteLength,c.set(a,2);let f=!1,l=null,u=!1,d=new $((t.dataBudgetMB||0)*1024*1024),h=null,y=()=>{if(u)return;u=!0;let p=__sfx("5Y2V6L+e5o6l5rWB6YeP6LaF6L+HIA==")+t.dataBudgetMB+__sfx("TUIg5LiK6ZmQ");if(Ue(`${s.header.hostname}:${s.header.port}`,{kind:"budget",message:p,candidate:"traffic"},p),i.close)try{i.close()}catch{}try{h?.close()}catch{}},R=p=>d.add(p)?(y(),!0):!1;gn(s.payload,i.writable,void 0,!1,R).catch(()=>{});let C=new ReadableStream({start(p){h=p,p.enqueue(c),f=!0},async pull(p){if(!(u||!f)){l||(l=i.readable.getReader());try{let{done:w,value:S}=await l.read();if(u)return;if(w){if(i.close)try{i.close()}catch{}p.close();return}if(S&&S.byteLength>0){if(d.add(S.byteLength)){y();return}p.enqueue(S)}}catch(w){if(u)return;if(i.close)try{i.close()}catch{}try{p.error(w)}catch{}}}},cancel(p){u=!0;try{i.readable.cancel(p)}catch{}if(i.close)try{i.close()}catch{}}});return new Response(C,{status:200,headers:{"Content-Type":"text/event-stream","Cache-Control":"no-store","X-Accel-Buffering":"no"}})}var Zr,De,dt=x(()=>{"use strict";ie();We();Re();ut();Zr=2e3;De=[]});function Le(){return new Response(JSON.stringify({build:mt,version:Qr,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var mt,Qr,ve,ht=x(()=>{"use strict";mt="56a28f5-6a8a5b51",Qr=__sfx("MC4xMy4xMQ=="),ve=__sfx("L19fY2ZwX3ZlcnNpb24=")});function Rn(e){return e[__sfx("S1Y=")]?new te(e[__sfx("S1Y=")]):new gt}var te,gt,Ne=x(()=>{"use strict";te=class{constructor(t){this.kv=t}kv;async get(t){return await this.kv.get(t)}async put(t,n,o){o&&o>=60?await this.kv.put(t,n,{expirationTtl:o}):await this.kv.put(t,n)}async delete(t){await this.kv.delete(t)}async list(t){let n=[],o;do{let r=await this.kv.list({prefix:t,cursor:o});for(let s of r.keys)n.push(s.name);o=r.list_complete?void 0:r.cursor}while(o);return n}},gt=class{data=new Map;async get(t){let n=this.data.get(t);return n?n.expiresAt>0&&n.expiresAt<=Date.now()?(this.data.delete(t),null):n.value:null}async put(t,n,o){let r=o?Date.now()+o*1e3:0;this.data.set(t,{value:n,expiresAt:r})}async delete(t){this.data.delete(t)}async list(t){return[...this.data.keys()].filter(n=>n.startsWith(t))}}});function V(e,t){if(e==null)return t;let n=String(e).trim();if(n==="")return t;let o=Number(n);return Number.isFinite(o)?o:t}function B(e,t){if(e==null||e==="")return t;let n=String(e).trim().toLowerCase();return["1","true","yes","on"].includes(n)?!0:["0","false","no","off"].includes(n)?!1:t}function qr(e){let t=e.trim().toLowerCase();return t==="global"||t==="fallback"||t==="smart"?t:"only"}function Tn(e){return e.trim().toLowerCase()==="signed"?"signed":"legacy"}function kn(e){return e.trim().toLowerCase()==="doh"?"doh":"off"}function T(e,t){return e==null?t:String(e)}function _r(e){return{uuid:T(e[__sfx("VVVJRA==")],""),[__sfx("dHJvamFuUGFzc3dvcmQ=")]:T(e[__sfx("VFJPSkFOX1BBU1NXT1JE")],""),wsPath:T(e[__sfx("V1NfUEFUSA==")]||e[__sfx("UEFUSA==")],A.wsPath),[__sfx("dHJvamFuUGF0aA==")]:A[__sfx("dHJvamFuUGF0aA==")],[__sfx("eGh0dHBQYXRo")]:A[__sfx("eGh0dHBQYXRo")],add:T(e[__sfx("QURE")],""),addApi:T(e[__sfx("QUREQVBJ")],""),addCsv:T(e[__sfx("QUREX0NTVg==")],""),poolOfficial:B(e[__sfx("T0ZGSUNJQUxfSVA=")],A.poolOfficial),officialCount:V(e[__sfx("T0ZGSUNJQUxfSVBfQ09VTlQ=")],A.officialCount),poolDomain:B(e[__sfx("UFJFRkVSUkVEX0RPTUFJTg==")],A.poolDomain),domainCount:V(e[__sfx("UFJFRkVSUkVEX0RPTUFJTl9DT1VOVA==")],A.domainCount),poolManual:B(e[__sfx("TUFOVUFMX0lQ")],A.poolManual),poolCountries:T(e[__sfx("UE9PTF9DT1VOVFJJRVM=")],A.poolCountries),dls:V(e[__sfx("RExT")],0),maxLatency:V(e[__sfx("TUFYX0xBVEVOQ1k=")],0),maxNodes:0,[__sfx("cHJveHlJcA==")]:T(e[__sfx("UFJPWFlJUA==")],""),[__sfx("c29ja3M1")]:T(e[__sfx("U09DS1M1")],""),httpProxy:T(e[__sfx("SFRUUF9QUk9YWQ==")],""),proxyMode:qr(T(e[__sfx("UFJPWFlfTU9ERQ==")],"")),nat64:T(e[__sfx("TkFUNjQ=")],""),concurrentDial:B(e[__sfx("VENQX0NPTkNVUlJFTlRfRElBTA==")],!0),dataBudgetMB:V(e[__sfx("REFUQV9CVURHRVRfTUI=")],A.dataBudgetMB),resolvePreferred:B(e[__sfx("UkVTT0xWRV9QUkVGRVJSRUQ=")],A.resolvePreferred),relayPool:T(e[__sfx("UkVMQVlfUE9PTA==")],""),useBuiltinRelay:B(e[__sfx("VVNFX0JVSUxUSU5fUkVMQVk=")],A.useBuiltinRelay),[__sfx("ZW5hYmxlVHJvamFu")]:B(e[__sfx("RU5BQkxFX1RST0pBTg==")]??e[__sfx("VFJPSkFO")],A[__sfx("ZW5hYmxlVHJvamFu")]),[__sfx("ZW5hYmxlWGh0dHA=")]:B(e[__sfx("RU5BQkxFX1hIVFRQ")]??e[__sfx("WEhUVFA=")],A[__sfx("ZW5hYmxlWGh0dHA=")]),subDomain:"",subProtocol:"both",subTransport:"both",subVariants:T(e[__sfx("U1VCX1ZBUklBTlRT")],A.subVariants),subName:T(e[__sfx("U1VCX05BTUU=")],A.subName).trim()||A.subName,subPorts:T(e[__sfx("U1VCX1BPUlRT")],A.subPorts),clientFingerprint:A.clientFingerprint,ech:B(e[__sfx("RUNI")],A.ech),echHost:T(e[__sfx("RUNIX0hPU1Q=")],A.echHost),echDns:T(e[__sfx("RUNIX0ROUw==")],A.echDns),tlsFragment:!1,tlsFragmentSize:A.tlsFragmentSize,tlsFragmentDelay:A.tlsFragmentDelay,subToken:Tn(T(e[__sfx("U1VCX1RPS0VOX01PREU=")],"")),subTokenTtlDays:V(e[__sfx("U1VCX1RPS0VOX1RUTF9EQVlT")],A.subTokenTtlDays),unlockProbe:B(e[__sfx("VU5MT0NLX1BST0JF")],A.unlockProbe),udpDns:kn(T(e[__sfx("VURQX0ROUw==")],"")),udpDnsEndpoint:T(e[__sfx("VURQX0ROU19FTkRQT0lOVA==")],A.udpDnsEndpoint)}}function $r(e,t){let n={...e};for(let[o,r]of Object.entries(t))if(r!=null)if(o==="dls"||o==="maxLatency"||o==="maxNodes"||o==="officialCount"||o==="domainCount"||o==="dataBudgetMB"||o==="subTokenTtlDays")n[o]=V(r,0);else if(o==="concurrentDial"||o==="resolvePreferred"||o==="useBuiltinRelay"||o===__sfx("ZW5hYmxlVHJvamFu")||o===__sfx("ZW5hYmxlWGh0dHA=")||o==="tlsFragment"||o==="ech"||o==="poolOfficial"||o==="poolDomain"||o==="poolManual"||o==="unlockProbe")n[o]=B(r,!1);else if(o==="subProtocol"){let s=String(r);n[o]=s===__sfx("dmxlc3M=")||s===__sfx("dHJvamFu")||s==="both"?s:"both"}else if(o==="subTransport"){let s=String(r);n[o]=s==="ws"||s===__sfx("eGh0dHA=")||s==="both"?s:"both"}else o==="subToken"?n[o]=Tn(String(r)):o==="udpDns"?n[o]=kn(String(r)):n[o]=String(r);return n}async function Dn(e,t){let n=_r(t),o=await e.get(Cn),r={};if(o)try{r=JSON.parse(o)}catch{r={}}let s=$r(n,r),i=!1,a=e instanceof te;return!s.uuid&&a&&(s.uuid=He(),i=!0),!s[__sfx("dHJvamFuUGFzc3dvcmQ=")]&&a&&(s[__sfx("dHJvamFuUGFzc3dvcmQ=")]=He().replace(/-/g,"").slice(0,16),i=!0),s.officialCount<1&&(s.officialCount=A.officialCount,i=!0),s.domainCount<1&&(s.domainCount=A.domainCount,i=!0),i&&await eo(e,s),s}async function eo(e,t){await e.put(Cn,JSON.stringify(t))}var Cn,A,Ie=x(()=>{"use strict";K();Ne();Cn="CONFIG",A={uuid:"",[__sfx("dHJvamFuUGFzc3dvcmQ=")]:"",wsPath:__sfx("L3ZsZXNz"),[__sfx("dHJvamFuUGF0aA==")]:__sfx("L3Ryb2phbg=="),[__sfx("eGh0dHBQYXRo")]:__sfx("L3hodHRw"),add:"",addApi:"",addCsv:"",poolOfficial:!0,officialCount:20,poolDomain:!0,domainCount:10,poolManual:!0,poolCountries:"",dls:0,maxLatency:0,maxNodes:0,[__sfx("cHJveHlJcA==")]:"",[__sfx("c29ja3M1")]:"",httpProxy:"",proxyMode:"only",nat64:"",concurrentDial:!0,dataBudgetMB:0,resolvePreferred:!0,relayPool:"",useBuiltinRelay:!0,[__sfx("ZW5hYmxlVHJvamFu")]:!0,[__sfx("ZW5hYmxlWGh0dHA=")]:!0,subDomain:"",subProtocol:__sfx("dmxlc3M="),subTransport:"ws",subVariants:__sfx("dmxlc3Mtd3M="),subName:__sfx("Q0ZQaWxvdA=="),subPorts:"443",clientFingerprint:"chrome",ech:!1,echHost:__sfx("Y2xvdWRmbGFyZS1lY2guY29t"),echDns:"",tlsFragment:!1,tlsFragmentSize:"10-20",tlsFragmentDelay:"10-20",subToken:"legacy",subTokenTtlDays:0,unlockProbe:!1,udpDns:"off",udpDnsEndpoint:"https://dns.google/dns-query"}});var Un,to,ys,no,bs,vn=x(()=>{"use strict";Un={[__sfx("SEs=")]:["HKG"],[__sfx("VFc=")]:["TPE","KHH"],[__sfx("SlA=")]:["NRT","KIX","CTS","FUK"],[__sfx("S1I=")]:["ICN","PUS"],[__sfx("U0c=")]:["SIN"],[__sfx("TVk=")]:["KUL"],[__sfx("VEg=")]:["BKK"],[__sfx("Vk4=")]:["SGN","HAN"],[__sfx("SUQ=")]:["CGK","DPS"],[__sfx("UEg=")]:["MNL"],[__sfx("SU4=")]:["BOM","MAA","DEL"],[__sfx("QVU=")]:["SYD","MEL","BNE","PER"],[__sfx("Tlo=")]:["AKL"],[__sfx("VVM=")]:["LAX","SJC","SEA","ORD","DFW","IAD","EWR","ATL","MIA","DEN","PHX","BOS"],[__sfx("Q0E=")]:["YYZ","YVR","YYC"],[__sfx("R0I=")]:["LHR","MAN"],[__sfx("REU=")]:["FRA","MUC","BER"],[__sfx("RlI=")]:["CDG","MRS"],[__sfx("Tkw=")]:["AMS"],[__sfx("SVQ=")]:["MXP","FCO"],[__sfx("RVM=")]:["MAD","BCN"],[__sfx("U0U=")]:["ARN"],[__sfx("Q0g=")]:["ZRH"],[__sfx("QVQ=")]:["VIE"],[__sfx("UEw=")]:["WAW"],[__sfx("UlU=")]:["DME","SVO"],[__sfx("VFI=")]:["IST"],[__sfx("QUU=")]:["DXB"],[__sfx("SUw=")]:["TLV"],[__sfx("WkE=")]:["JNB"],[__sfx("QlI=")]:["GRU","GIG"],[__sfx("QVI=")]:["EZE"],[__sfx("Q0w=")]:["SCL"],[__sfx("TVg=")]:["MEX"]},to=__sfx("SEtH6aaZ5rivLFRQReWPsOWMlyxOUlTkuJzkuqwsS0lY5aSn6ZiqLElDTummluWwlCxTSU7mlrDliqDlnaEsS1VM5ZCJ6ZqG5Z2hLEJLS+abvOiwtyxTR07og6Hlv5fmmI7luIIsTU5M6ams5bC85ouJLFNZROaCieWwvCxNRUzloqjlsJTmnKwsTEFY5rSb5p2J55+2LFNKQ+Wco+S9leWhnixTRUHopb/pm4Xlm74sT1JE6Iqd5Yqg5ZOlLElBROWNjuebm+mhvyxFV1Lnur3nk6blhYssWVla5aSa5Lym5aSaLFlWUua4qeWTpeWNjixMSFLkvKbmlaYsRlJB5rOV5YWw5YWL56aPLENER+W3tOm7jixBTVPpmL/lp4bmlq/nibnkuLksTUFE6ams5b636YeMLEFSTuaWr+W+t+WTpeWwlOaRqSxJU1TkvIrmlq/lnabluIPlsJQsRFhC6L+q5ouc"),ys=(()=>{let e={};for(let t of to.split(","))t.length>3&&(e[t.slice(0,3)]=t.slice(3));return e})(),no=new Map;for(let[e,t]of Object.entries(Un))for(let n of t)no.set(n,e);bs=Object.keys(Un)});var Ln=x(()=>{"use strict"});var Is,Nn=x(()=>{"use strict";z();K();vn();Ln();Is=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});var Hs,In=x(()=>{"use strict";Ne();K();Hs=new TextEncoder});var ti,On=x(()=>{"use strict";Ie();K();ti=3600*24});function Mn(e){return Rn(e)}async function Bn(e,t){if(fe.config&&Date.now()-fe.configAt<ro)return fe.config;let n=await Dn(e,t);return fe.config=n,fe.configAt=Date.now(),n}var ro,fe,bt=x(()=>{"use strict";Ne();Ie();On();ro=15e3,fe={config:null,configAt:0,auth:null,authAt:0}});var Fn={};ge(Fn,{clearUnlockCache:()=>po,runUnlockProbe:()=>fo});function co(e,t,n){return e===200?"ok":e===404?t==="status"?"region":"unknown":e===403||e===451?"blocked":t==="trace"&&/\bloc=[A-Z]{2}\b/.test(n)?"ok":"unknown"}async function uo(e){let t=Date.now(),n=new AbortController,o=setTimeout(()=>n.abort(),io);try{let r=await fetch(e.url,{method:"GET",redirect:"manual",signal:n.signal,headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,*/*"}}),s="";e.mode==="trace"&&(s=(await r.text()).slice(0,512));let i=/\bloc=([A-Z]{2})\b/.exec(s)?.[1];return{id:e.id,status:r.status,verdict:co(r.status,e.mode,s),ms:Date.now()-t,...i?{loc:i}:{}}}catch(r){let s=r instanceof Error?r.message:String(r);return{id:e.id,status:0,verdict:"unknown",ms:Date.now()-t,error:/abort/i.test(s)?"timeout":"fetch-failed"}}finally{clearTimeout(o)}}async function fo(e,t){let n=e||"UNK",o=Date.now(),r=ne.get(n);if(r&&o-r.at<ao)return{...r.data,cached:!0};let s=await Promise.all(so.map(a=>uo(a))),i={colo:n,region:t,cached:!1,at:o,targets:s};if(ne.size>=lo){let a="",c=Number[__sfx("UE9TSVRJVkVfSU5GSU5JVFk=")];for(let[f,l]of ne)l.at<c&&(c=l.at,a=f);a&&ne.delete(a)}return ne.set(n,{at:o,data:i}),i}function po(){ne.clear()}var so,io,ao,lo,ne,Gn=x(()=>{"use strict";so=[{id:"netflix",url:"https://www.netflix.com/title/81215567",mode:"status"},{id:"youtube",url:"https://www.youtube.com/premium",mode:"status"},{id:"gemini",url:"https://gemini.google.com/",mode:"status"}],io=4e3,ao=600*1e3,lo=16,ne=new Map});K();var Jn=8*1024*1024,Qn=2*1024*1024,Tt=600*1e3,qn=6*1024*1024*1024,Fe=Date.now(),Ge=0;function kt(e){e-Fe>=Tt&&(Fe=e,Ge=0)}function _n(e,t=Date.now()){kt(t),Ge+=e}function Ct(e){return kt(e),qn-Ge}var $n=(()=>{let e=new Uint8Array(65536),t=2654435769;for(let n=0;n<e.length;n++)t^=t<<13,t^=t>>>17,t^=t<<5,e[n]=t&255;return e})(),er=5e3;function tr(e,t=er){let n=!1,o=setTimeout(()=>{if(!n){n=!0;try{e(1e3,"Probe idle timeout")}catch{}}},t),r=o;return typeof r?.unref=="function"&&r.unref(),{cancel:()=>{n||(n=!0,clearTimeout(o))}}}async function Ke(e){let t=new URL(e.url);if(e.headers.get("Upgrade")?.toLowerCase()===__sfx("d2Vic29ja2V0")){let f=new WebSocketPair,[l,u]=Object.values(f);u.accept();let d=tr((h,y)=>u.close(h,y));return u.addEventListener("message",h=>{let y=typeof h.data=="string"?h.data:"";if(y==="PING"||y==="ping"){d.cancel(),u.send(JSON.stringify({pong:!0,colo:e.cf?.colo??"UNK",clientIp:e.headers.get("CF-Connecting-IP")??""}));try{u.close(1e3,"Probe complete")}catch{}return}d.cancel();try{u.close(1e3,"Probe aborted")}catch{}}),u.addEventListener("close",()=>d.cancel()),u.addEventListener("error",()=>d.cancel()),new Response(null,{status:101,[__sfx("d2ViU29ja2V0")]:l})}let o=Number.parseInt(t.searchParams.get("bytes")??"",10),r=Number.isFinite(o)&&o>0?Math.min(o,Jn):Qn,s=Date.now();if(Ct(s)<=0){let f=Math.max(1e3,Fe+Tt-s);return new Response(JSON.stringify({ok:!1,error:"probe budget exhausted"}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(f/1e3))}})}let i=$n,a=0,c=new ReadableStream({pull(f){let l=Ct(Date.now());if(a>=r||l<=0){f.close();return}let u=Math.min(i.byteLength,r-a,l);f.enqueue(i.subarray(0,u)),a+=u,_n(u)}});return new Response(c,{status:200,headers:{"Content-Type":"application/octet-stream","Content-Encoding":"identity","Cache-Control":"no-store","Access-Control-Allow-Origin":"*","X-Probe-Bytes":String(r),"X-Probe-Nonce":be(4)}})}ft();dt();st();ht();K();Ie();Re();Nn();In();K();function yt(e){let t=e===200?"Welcome":e===404?"Not Found":"Service Unavailable",n=`<!DOCTYPE html><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${t}</title><style>body{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;background:#f7f8fa;color:#333;font-family:-apple-system,"Segoe UI","PingFang SC",sans-serif}.c{text-align:center}h1{font-size:22px;font-weight:600;margin:0 0 10px}p{color:#888;font-size:14px;margin:0}</style></head><body><div class="c"><h1>${t}</h1><p>This site is up and running.</p></div></body></html>`;return new Response(n,{status:e,headers:{"Content-Type":"text/html; charset=utf-8","Cache-Control":"no-store","X-Content-Type-Options":"nosniff"}})}bt();bt();async function Hn(e){let t=Mn(e);return await Bn(t,e)}function wt(e){let t=[];return t.push(...ce(e[__sfx("cHJveHlJcA==")],"direct")),t.push(...ce(e[__sfx("c29ja3M1")],__sfx("c29ja3M1"))),t.push(...ce(e.httpProxy,"http")),t}var xt=6e4,mo=10,pe=0,Oe=0;function Kn(e){return e>=Oe?(pe=0,Oe=e+xt,!1):pe>=mo}function zn(e,t,n){if(!n)return!1;let o=(e.headers.get(__sfx("eC1jZnBpbG90LXRva2Vu"))??t.searchParams.get("token")??"").trim();if(!o)return!1;let r=Date.now();return se(o,n)?(pe=0,!0):(r>=Oe&&(Oe=r+xt,pe=0),pe+=1,!1)}async function Wn(e,t,n){let o=new URL(e.url);if(o.pathname===__sfx("L19fZWRnZV9wcm9iZQ=="))return Ke(e);if(o.pathname===ve||o.pathname===__sfx("L19fdmVyc2lvbg=="))return Le();if(o.pathname==="/region"&&e.method==="GET"){let{coloToCountry:i,rankRegions:a}=await Promise.resolve().then(()=>(le(),rt)),c=e.cf?.colo??"",f=c?i(c):"";return new Response(JSON.stringify({ok:!0,colo:c,region:f,relayPreference:f?a(f):[],timestamp:new Date().toISOString()},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8"}})}let r=await Hn(t);if(o.pathname===__sfx("L19fZGlhZw==")){if(Kn(Date.now()))return new Response(JSON.stringify({ok:!1,error:"token attempts throttled"},null,2),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(xt/1e3))}});if(!zn(e,o,r.uuid))return null;let{recentDiagnostics:i}=await Promise.resolve().then(()=>(ft(),En)),{[__sfx("cmVjZW50WGh0dHBEaWFnbm9zdGljcw==")]:a}=await Promise.resolve().then(()=>(dt(),Pn));return new Response(JSON.stringify({ok:!0,impl:"self",build:mt,recent:i(),[__sfx("eGh0dHA=")]:a()},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}if(o.pathname==="/__unlock_probe"){if(!r.unlockProbe)return null;if(Kn(Date.now()))return new Response(JSON.stringify({ok:!1,error:"token attempts throttled"},null,2),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}});if(!zn(e,o,r.uuid))return null;let{coloToCountry:i}=await Promise.resolve().then(()=>(le(),rt)),{runUnlockProbe:a}=await Promise.resolve().then(()=>(Gn(),Fn)),c=e.cf?.colo??"",f=c?i(c):"",l=await a(c,f);return new Response(JSON.stringify({ok:!0,...l},null,2),{status:200,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}})}let s=e.headers.get("Upgrade")?.toLowerCase();return o.pathname===r.wsPath?s!==__sfx("d2Vic29ja2V0")?null:await ke(e,__sfx("dmxlc3M="),r,wt(r),n):r[__sfx("ZW5hYmxlVHJvamFu")]&&o.pathname===r[__sfx("dHJvamFuUGF0aA==")]?s!==__sfx("d2Vic29ja2V0")?null:await ke(e,__sfx("dHJvamFu"),r,wt(r),n):r[__sfx("ZW5hYmxlWGh0dHA=")]&&o.pathname===r[__sfx("eGh0dHBQYXRo")]?e.method!=="POST"?null:await pt(e,r,wt(r)):null}ht();var Zi={async fetch(e,t,n){try{return new URL(e.url).pathname===ve?Le():await Wn(e,t,n)??yt(200)}catch{return yt(500)}}};export{Zi as default};
|
package/assets/worker.js
CHANGED
|
@@ -3,7 +3,7 @@ var hs=Object.defineProperty;var T=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(
|
|
|
3
3
|
`))),i){let S=`${w} Trojan`;r.push(S),n.push([` - name: ${ee(S)}`," type: trojan",` password: ${ee(e.config.trojanPassword)}`,` server: ${m.ip}`,` port: ${A}`," network: ws"," tls: true",` sni: ${e.domain}`,` client-fingerprint: ${e.config.clientFingerprint}`,...l()," ws-opts:",` path: ${ee(e.config.trojanPath)}`," headers:",` Host: ${e.domain}`].join(`
|
|
4
4
|
`))}}});t.push("# CFPilot \u81EA\u52A8\u751F\u6210\u8BA2\u9605"),t.push("mixed-port: 7890"),t.push("allow-lan: false"),t.push("mode: rule"),t.push("log-level: info"),t.push("unified-delay: true"),t.push("tcp-concurrent: true"),t.push(""),t.push("dns:"),t.push(" enable: true"),t.push(" ipv6: false"),t.push(" enhanced-mode: fake-ip"),t.push(" fake-ip-range: 198.18.0.1/16"),t.push(" default-nameserver:"),t.push(" - 223.5.5.5"),t.push(" - 119.29.29.29"),t.push(" nameserver:"),t.push(" - https://223.5.5.5/dns-query"),t.push(" - https://dns.alidns.com/dns-query"),t.push(" fallback:"),t.push(" - 8.8.4.4"),t.push(" - 1.1.1.1"),t.push(" fallback-filter:"),t.push(" geoip: true"),t.push(" geoip-code: CN"),t.push(""),a&&(t.push(" nameserver-policy:"),t.push(` ${ee(c)}: ${f?ee(f):"https://223.5.5.5/dns-query"}`),t.push(""));let u=or(e.routeProfile??"",{mainGroup:"CFPilot",autoGroup:"\u81EA\u52A8\u9009\u62E9"});if(t.push("proxies:"),n.length===0?t.push(" []"):t.push(...n),t.push(""),t.push("proxy-groups:"),t.push(' - name: "CFPilot"'),t.push(" type: select"),t.push(" proxies:"),t.push(' - "\u81EA\u52A8\u9009\u62E9"'),t.push(' - "\u6545\u969C\u8F6C\u79FB"'),r.length===0)t.push(" []");else for(let d of r)t.push(` - ${ee(d)}`);if(r.length>0){t.push(""),t.push(' - name: "\u81EA\u52A8\u9009\u62E9"'),t.push(" type: url-test"),t.push(' url: "http://www.gstatic.com/generate_204"'),t.push(" interval: 300"),t.push(" tolerance: 50"),t.push(" proxies:");for(let d of r)t.push(` - ${ee(d)}`);t.push(""),t.push(' - name: "\u6545\u969C\u8F6C\u79FB"'),t.push(" type: fallback"),t.push(' url: "http://www.gstatic.com/generate_204"'),t.push(" interval: 300"),t.push(" proxies:");for(let d of r)t.push(` - ${ee(d)}`)}return u.groups.length>0&&(t.push(""),t.push(...u.groups)),t.push(""),t.push("rules:"),u.rules.length>0?(t.push(...u.rules),u.rules.some(d=>d.includes("MATCH,"))||t.push(" - MATCH,CFPilot")):t.push(...rr("CFPilot")),t.push(""),t.join(`
|
|
5
5
|
`)}function ri(e){let t=[],n=[],r=Gt(e.config.subVariants,e.config,hr),o=r.some(l=>l==="vless-ws"),s=r.includes("trojan"),i=e.config.ech,a=e.config.echHost.trim()||"cloudflare-ech.com",c=()=>i?{ech:{enabled:!0,query_server_name:a}}:{};for(let l of Kt(e)){let u=[];l.entries.forEach((d,m)=>{let g=`${l.name} ${Fe(d,"vless",m,"")}`;for(let y of jt(d,e)){let A=e.ports.length>1?`:${y}`:"",p=`${g}${A}`,w=`${p} Trojan`;o&&u.push(p),s&&u.push(w),o&&t.push({type:"vless",tag:p,server:d.ip,server_port:y,uuid:e.config.uuid,tls:{enabled:!0,server_name:e.domain,insecure:!1,utls:{enabled:!0,fingerprint:e.config.clientFingerprint},...c()},transport:{type:"ws",path:e.config.wsPath,headers:{Host:e.domain}}}),s&&t.push({type:"trojan",tag:w,server:d.ip,server_port:y,password:e.config.trojanPassword,tls:{enabled:!0,server_name:e.domain,insecure:!1,utls:{enabled:!0,fingerprint:e.config.clientFingerprint},...c()},transport:{type:"ws",path:e.config.trojanPath,headers:{Host:e.domain}}})}}),u.length>0&&n.push({tag:l.name,members:u})}t.push({type:"direct",tag:"direct"});for(let l of n)t.push({type:"selector",tag:l.tag,outbounds:l.members,default:l.members[0]});return t.push({type:"selector",tag:"CFPilot",outbounds:n.length>0?n.map(l=>l.tag):["direct"],default:n.length>0?n[0].tag:"direct"}),JSON.stringify({log:{level:"info",timestamp:!0},dns:{servers:[{tag:"dns-out",address:"https://1.1.1.1/dns-query"},{tag:"local",address:"local"}],rules:[{domain_suffix:gr,server:"local"}]},inbounds:[{type:"mixed",tag:"mixed-in",listen:"127.0.0.1",listen_port:2080}],outbounds:t,route:{rules:[{ip_is_private:!0,outbound:"direct"},{domain_suffix:gr,outbound:"direct"}],final:"CFPilot",auto_detect_interface:!0}},null,2)}function oi(e){let t=[],n=Gt(e.config.subVariants,e.config);for(let r of Kt(e))r.entries.forEach((o,s)=>{let i=Fe(o,"vless",s,r.name);for(let a of jt(o,e)){let c=e.ports.length>1?`:${a}`:"",f=`${i}${c}`,l={...o,port:a};for(let u of n)u==="vless-ws"?t.push(mr(l,e,"ws",`${f} WS`)):u==="vless-xhttp"?t.push(mr(l,e,"xhttp",`${f} XHTTP`)):t.push(ti(l,e,`${f} Trojan`))}});return zn(t.join(`
|
|
6
|
-
`))}function Ar(e,t){let n=zt(t.config.subName);switch(e){case"clash":return{body:ni(t),contentType:"text/yaml; charset=utf-8",fileName:n};case"singbox":return{body:ri(t),contentType:"application/json; charset=utf-8",fileName:n};default:return{body:oi(t),contentType:"text/plain; charset=utf-8",fileName:n}}}var pe,Ns,Is,ir,ar,lr,Os,Ms,Bs,Vs,Qs,_s,de,qs,pr,hr,$s,gr,Wt=T(()=>{"use strict";ie();oe();Mt();sr();pe=443;Ns=["ip\u5730\u5740","ip \u5730\u5740","ip","\u5730\u5740","\u670D\u52A1\u5668","server","host"],Is=["\u7AEF\u53E3","port"],ir=["\u4E0B\u8F7D\u901F\u5EA6","\u901F\u5EA6","speed","download"],ar=["\u5E73\u5747\u5EF6\u8FDF","\u5EF6\u8FDF","latency","delay","\u54CD\u5E94\u65F6\u95F4","rtt"],lr=["colo","\u673A\u623F","\u6570\u636E\u4E2D\u5FC3","\u5730\u533A","region"],Os=["\u56FD\u5BB6","country","\u56FD\u522B"],Ms=["\u57CE\u5E02","city"],Bs=["tls","\u662F\u5426\u652F\u6301tls","\u652F\u6301tls"];Vs={official:"\u5B98\u65B9\u4F18\u9009IP",domain:"\u4F18\u9009\u57DF\u540D",manual:"\u624B\u52A8\u4F18\u9009IP",api:"\u8FDC\u7A0BAPI",csv:"\u6D4B\u901FCSV"};Qs=12e4,_s=32,de=new Map,qs="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36";pr=["vless-ws","vless-xhttp","trojan"];hr=["vless-ws","trojan"];$s=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;gr=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});function di(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Rr(e,t){let n=await crypto.subtle.importKey("raw",Tr.encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",n,Tr.encode(t));return di(new Uint8Array(r))}async function lt(e){let t=(await e.get(at))?.trim();if(t)return t;let n=kr();return e instanceof se&&await e.put(at,n),n}async function Dr(e){let t=kr();return e instanceof se?await e.put(at,t):await e.put(at,t),t}async function vr(e,t={}){let n=t.ttlDays??0,r=Math.floor((t.now??Date.now())/1e3),o=n>0?r+Math.round(n*86400):0,s=Math.floor(Math.random()*36**8).toString(36).padStart(8,"0"),i=`${Zt}.${o.toString(36)}.${s}`,a=(await Rr(e,i)).slice(0,Vt);return`${i}.${a}`}async function ct(e,t,n=Date.now()){if(!e||!t)return{ok:!1,reason:"format"};let r=t.split(".");if(r.length!==4||r[0]!==Zt)return{ok:!1,reason:"format"};let o=r[1],s=r[2],i=r[3];if(!o||!s||i.length!==Vt)return{ok:!1,reason:"format"};let a=Number.parseInt(o,36);if(!Number.isFinite(a)||a<0)return{ok:!1,reason:"format"};let c=(await Rr(e,`${Zt}.${o}.${s}`)).slice(0,Vt);return q(i,c)?a>0&&Math.floor(n/1e3)>=a?{ok:!1,reason:"expired",exp:a}:{ok:!0,exp:a}:{ok:!1,reason:"signature"}}var at,Zt,Vt,Tr,kr,Jt=T(()=>{"use strict";_e();oe();at="SUB_TOKEN_SECRET",Zt="v1",Vt=22,Tr=new TextEncoder;kr=()=>J(32)});function gi(e){let t="";for(let n of e)t+=(n<16?"0":"")+n.toString(16);return t}function hi(e){if(!/^[0-9a-f]*$/.test(e)||e.length%2!==0)return null;let t=new Uint8Array(new ArrayBuffer(e.length/2));for(let n=0;n<t.length;n++)t[n]=Number.parseInt(e.slice(n*2,n*2+2),16);return t}async function Br(e,t,n){let r=hi(t);if(!r)return null;let o=await crypto.subtle.importKey("raw",new TextEncoder().encode(e),"PBKDF2",!1,["deriveBits"]),s=await crypto.subtle.deriveBits({name:"PBKDF2",salt:r,iterations:n,hash:"SHA-256"},o,256);return gi(new Uint8Array(s))}function Hr(e){if(e.startsWith(`${_t}$`)){let[r,o,s,i]=e.split("$");if(r!==_t||!s||!i)return null;let a=Number.parseInt(o??"",10);return!Number.isFinite(a)||a<1||a>1e6?null:{scheme:"pbkdf2",salt:s,iterations:a,expected:i}}let[t,n]=e.split(":");return!t||!n?null:{scheme:"sha256",salt:t,iterations:0,expected:n}}async function Fr(e,t){return e.scheme==="pbkdf2"?await Br(t,e.salt,e.iterations):await vt(`${e.salt}:${t}`)}async function qt(e,t){let n=await Br(e,t,Ir);return n?`${_t}$${Ir}$${t}$${n}`:`${t}:${await vt(`${t}:${e}`)}`}async function yi(e,t){let n=Hr(e);if(!n)return!1;let r=await Fr(n,t);return r?q(r,n.expected):!1}function Or(e){return`/${e.trim().replace(/^\/+/,"")}`}async function Gr(e,t,n){let r=await e.get(et)??"",o=n&&n.trim()?Or(n):"";o?r!==o&&(r=o,await e.put(et,r)):r||(r=Or(`${Xn}-${Kn(6)}`),await e.put(et,r));let s=await e.get(ke)??"",i=null,a=t&&t.trim()?t.trim():"";if(a){if(!s||!await yi(s,a)){let f=J(8);s=await qt(a,f),await e.put(ke,s)}await e.get(ye)&&await e.delete(ye)}else if(!s){let c=`cfp-${J(8)}`,f=J(8);s=await qt(c,f),await e.put(ke,s),i=c,await e.put(ye,c)}return{panelPath:r,passwordHash:s,generatedPassword:i}}async function Kr(e,t){let n=Hr(e.passwordHash);if(!n)return{ok:!1,legacy:!1};let r=await Fr(n,t);if(!r)return{ok:!1,legacy:!1};let o=q(r,n.expected);return{ok:o,legacy:o&&n.scheme==="sha256"}}async function zr(e,t){let n=J(8);await e.put(ke,await qt(t,n))}async function jr(e){await e.get(ye)&&await e.delete(ye)}function Wr(e){let t=e.headers.get("Cookie")??"",n={};for(let r of t.split(";")){let o=r.indexOf("=");if(o<0)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&(n[s]=decodeURIComponent(i))}return n}async function Yr(e){let t=J(24);return await e.put(`${$e}${t}`,JSON.stringify({ua:"",t:Date.now()}),Mr),t}async function $t(e,t){let n=Wr(t)[ft];return n?!!await e.get(`${$e}${n}`):!1}function Xr(e,t=Mr){return`${ft}=${e}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=${t}`}function Zr(){return`${ft}=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=0`}async function Vr(e,t){let n=Wr(t)[ft];n&&await e.delete(`${$e}${n}`)}async function Jr(e){let t=J(20);return await e.put(`${qe}${t}`,"1",mi),t}async function Qr(e,t){if(!t)return!1;let n=await e.get("SCANNER_TOKEN");return n&&q(n,t)?!0:await e.get(`${qe}${t}`)?(await e.delete(`${qe}${t}`),!0):!1}var ft,Mr,mi,Ir,_t,en=T(()=>{"use strict";Ne();oe();ft="cfpilot_sess",Mr=3600*24,mi=600,Ir=3e4,_t="pbkdf2"});function tn(e){return jn(e)}async function dt(e,t){if(_.config&&Date.now()-_.configAt<bi)return _.config;let n=await Jn(e,t);return _.config=n,_.configAt=Date.now(),n}function _r(){_.config=null,_.configAt=0}async function nn(e,t){if(_.auth&&Date.now()-_.authAt<wi)return _.auth;let n=await Gr(e,t.PANEL_PASSWORD,t.PANEL_PATH);return _.auth=n,_.authAt=Date.now(),n}function rn(e){switch((e??"").toLowerCase()){case"clash":case"mihomo":case"yaml":return"clash";case"singbox":case"sing-box":case"json":return"singbox";case"v2ray":return"v2ray";case"base64":return"base64";default:return"base64"}}function Ge(e){let t=String(e??"").trim();if(!t)return t;t=t.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,""),t=t.replace(/[/?#].*$/,"");let n=t.lastIndexOf("@");if(n>=0&&(t=t.slice(n+1)),t.startsWith("[")){let r=t.indexOf("]");r>0&&(t=t.slice(1,r))}else{let r=t.indexOf(":");r>=0&&t.indexOf(":",r+1)<0&&(t=t.slice(0,r))}return t.trim()}function qr(e){let t=(e??"").toLowerCase();return t?t.includes("clash")||t.includes("mihomo")||t.includes("flclash")||t.includes("clashx")||t.includes("stash")?"clash":t.includes("sing-box")||t.includes("singbox")?"singbox":t.includes("v2ray")||t.includes("v2rayng")||t.includes("shadowrocket")||t.includes("nekobox")||t.includes("surge")||t.includes("loon")||t.includes("quantumult")?"base64":null:null}var bi,wi,_,pt=T(()=>{"use strict";_e();Ne();en();bi=15e3,wi=6e4,_={config:null,configAt:0,auth:null,authAt:0}});function on(e,t,n){if(!e){n.push({field:t,message:`${t} \u4E0D\u80FD\u4E3A\u7A7A`});return}if(!e.startsWith("/")){n.push({field:t,message:`${t} \u5FC5\u987B\u4EE5 / \u5F00\u5934`});return}if(e.length>128){n.push({field:t,message:`${t} \u8FC7\u957F\uFF08\u6700\u591A 128 \u5B57\u7B26\uFF09`});return}/[\s\u0000-\u001f]/.test(e)&&n.push({field:t,message:`${t} \u4E0D\u80FD\u5305\u542B\u7A7A\u683C\u6216\u63A7\u5236\u5B57\u7B26`})}function me(e,t,n,r,o){if(!Number.isFinite(e)){o.push({field:t,message:`${t} \u5FC5\u987B\u662F\u6570\u5B57`});return}(e<n||e>r)&&o.push({field:t,message:`${t} \u5FC5\u987B\u5728 ${n} ~ ${r} \u4E4B\u95F4\uFF08\u5F53\u524D ${e}\uFF09`})}function mt(e,t,n){let r=e.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>20){n.push({field:t,message:`${t} \u6700\u591A 20 \u6761\uFF08\u5F53\u524D ${r.length}\uFF09`});return}for(let o of r)if(!Si.test(o)){n.push({field:t,message:`${t} \u91CC\u6709\u65E0\u6CD5\u8BC6\u522B\u7684\u6761\u76EE\uFF1A${o.slice(0,40)}`});return}}function $r(e,t,n){let r=e.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>10){n.push({field:t,message:`${t} \u6700\u591A 10 \u6761\uFF08\u5F53\u524D ${r.length}\uFF09`});return}for(let o of r)if(!/^https?:\/\/\S+$/i.test(o)){n.push({field:t,message:`${t} \u5FC5\u987B\u662F http(s) \u5730\u5740\uFF1A${o.slice(0,40)}`});return}}function sn(e){let t=[],n=o=>Object.prototype.hasOwnProperty.call(e,o);n("wsPath")&&on(String(e.wsPath??""),"wsPath",t),n("trojanPath")&&on(String(e.trojanPath??""),"trojanPath",t),n("xhttpPath")&&on(String(e.xhttpPath??""),"xhttpPath",t);let r=["wsPath","trojanPath","xhttpPath"].filter(o=>n(o)).map(o=>`${o}=${String(e[o]??"")}`);if(r.length>=2){let o=r.map(s=>s.slice(s.indexOf("=")+1));new Set(o).size!==o.length&&t.push({field:"paths",message:"wsPath / trojanPath / xhttpPath \u4E0D\u80FD\u91CD\u590D"})}if(n("subDomain")){let o=String(e.subDomain??"").trim();o&&(!xi.test(o)||o.includes("/"))&&t.push({field:"subDomain",message:"subDomain \u5FC5\u987B\u662F\u5408\u6CD5\u4E3B\u673A\u540D\uFF08\u4E0D\u542B\u534F\u8BAE\u4E0E\u8DEF\u5F84\uFF09"})}if(n("proxyIp")&&mt(String(e.proxyIp??""),"proxyIp",t),n("socks5")&&mt(String(e.socks5??""),"socks5",t),n("httpProxy")&&mt(String(e.httpProxy??""),"httpProxy",t),n("relayPool")&&mt(String(e.relayPool??""),"relayPool",t),n("officialCount")&&me(Number(e.officialCount),"officialCount",1,200,t),n("domainCount")&&me(Number(e.domainCount),"domainCount",1,200,t),n("maxNodes")&&me(Number(e.maxNodes),"maxNodes",0,500,t),n("dls")&&me(Number(e.dls),"dls",0,1e3,t),n("maxLatency")&&me(Number(e.maxLatency),"maxLatency",0,1e4,t),n("dataBudgetMB")&&me(Number(e.dataBudgetMB),"dataBudgetMB",0,102400,t),n("subTokenTtlDays")&&me(Number(e.subTokenTtlDays),"subTokenTtlDays",0,3650,t),n("subPorts")){let o=String(e.subPorts??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>6?t.push({field:"subPorts",message:"subPorts \u6700\u591A 6 \u4E2A\u7AEF\u53E3"}):s.every(i=>/^\d{1,5}$/.test(i)&&Number(i)>=1&&Number(i)<=65535)||t.push({field:"subPorts",message:"subPorts \u91CC\u6BCF\u4E2A\u7AEF\u53E3\u90FD\u5FC5\u987B\u662F 1~65535 \u7684\u6570\u5B57"})}}if(n("subName")){let o=String(e.subName??"");o.length>40&&t.push({field:"subName",message:"subName \u6700\u591A 40 \u5B57\u7B26"}),/[\u0000-\u001f]/.test(o)&&t.push({field:"subName",message:"subName \u4E0D\u80FD\u5305\u542B\u63A7\u5236\u5B57\u7B26"})}if(n("addApi")&&$r(String(e.addApi??""),"addApi",t),n("addCsv")&&$r(String(e.addCsv??""),"addCsv",t),n("uuid")){let o=String(e.uuid??"").trim();o&&!/^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$/.test(o)&&t.push({field:"uuid",message:"uuid \u5FC5\u987B\u662F\u6807\u51C6 UUID\uFF0836 \u4F4D\uFF0C\u53EF\u5E26\u8FDE\u5B57\u7B26\uFF09"})}if(n("poolCountries")){let o=String(e.poolCountries??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>30?t.push({field:"poolCountries",message:"poolCountries \u6700\u591A 30 \u4E2A\u56FD\u5BB6/\u5730\u533A"}):s.every(i=>/^[A-Za-z]{2,3}$/.test(i))||t.push({field:"poolCountries",message:"poolCountries \u53EA\u80FD\u662F 2~3 \u4F4D\u5B57\u6BCD\u4EE3\u7801"})}}if(n("udpDnsEndpoint")){let o=String(e.udpDnsEndpoint??"").trim();o&&!/^https:\/\/\S+$/i.test(o)&&t.push({field:"udpDnsEndpoint",message:"udpDnsEndpoint \u5FC5\u987B\u662F https \u5730\u5740"})}return t}function an(e){return e.length===0?"":e.length===1?e[0].message:`\u6709 ${e.length} \u9879\u914D\u7F6E\u4E0D\u5408\u6CD5\uFF1A${e.map(t=>t.message).join("\uFF1B")}`}var xi,Si,eo=T(()=>{"use strict";xi=/^(?=.{1,253}$)([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)(\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,Si=/^(?:(?:socks5|socks|socks5h|http|https):\/\/)?(?:[^\s@/]+@)?(?:\[[0-9a-fA-F:]+\]|[A-Za-z0-9._-]+)(?::\d{1,5})?$/});function ro(e,t=Date.now()){let n={};for(let o of no){let s=e[o];s!==void 0&&(n[o]=s)}let r=Ai.map(o=>({field:o.field,reason:o.reason}));for(let o of["socks5","httpProxy"]){let s=String(e[o]??"");if(!s){n[o]="";continue}if(s.includes("@")){r.push({field:o,reason:"\u542B\u7528\u6237\u540D/\u53E3\u4EE4\uFF0C\u9700\u624B\u5DE5\u91CD\u65B0\u586B\u5199"});continue}n[o]=s}return{schemaVersion:1,exportedAt:new Date(t).toISOString(),config:n,omitted:r}}function oo(e){let t=new Set([...no.map(String),"socks5","httpProxy"]),n={};for(let[r,o]of Object.entries(e))t.has(r)&&(n[r]=o);return n}function to(e){if(e==null)return"\uFF08\u7A7A\uFF09";if(typeof e=="string"){let t=e.replace(/\s+/g," ").trim();return t.length>60?`${t.slice(0,60)}\u2026`:t||"\uFF08\u7A7A\uFF09"}return String(e)}function so(e,t){let n=[];for(let[r,o]of Object.entries(t)){let s=e[r];String(s)!==String(o)&&n.push({field:r,from:to(s),to:to(o)})}return n}var no,Ai,io=T(()=>{"use strict";no=["poolOfficial","officialCount","poolDomain","domainCount","poolManual","poolCountries","add","dls","maxLatency","maxNodes","proxyIp","relayPool","useBuiltinRelay","proxyMode","nat64","concurrentDial","dataBudgetMB","resolvePreferred","enableTrojan","enableXhttp","subProtocol","subTransport","subVariants","subName","subPorts","clientFingerprint","ech","echHost","echDns","tlsFragment","tlsFragmentSize","tlsFragmentDelay","subToken","subTokenTtlDays","unlockProbe","udpDns","udpDnsEndpoint"],Ai=[{field:"uuid",reason:"\u5165\u7AD9\u51ED\u636E"},{field:"trojanPassword",reason:"\u5165\u7AD9\u51ED\u636E"},{field:"wsPath",reason:"\u5B9E\u4F8B\u6807\u8BC6\uFF08\u8BA2\u9605\u94FE\u63A5\u91CC\u53EF\u89C1\uFF0C\u5BFC\u51FA\u5373\u66B4\u9732\u5165\u53E3\uFF09"},{field:"trojanPath",reason:"\u5B9E\u4F8B\u6807\u8BC6"},{field:"xhttpPath",reason:"\u5B9E\u4F8B\u6807\u8BC6"},{field:"subDomain",reason:"\u5B9E\u4F8B\u6807\u8BC6"},{field:"addApi",reason:"URL \u53EF\u80FD\u542B\u79C1\u6709 token"},{field:"addCsv",reason:"URL \u53EF\u80FD\u542B\u79C1\u6709 token"}]});function lo(){return new Response(JSON.stringify({build:Ke,version:ln,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var Ke,ln,ao,cn=T(()=>{"use strict";Ke="00082f0-6a8a5b51",ln="0.13.9",ao="/__cfp_version"});var fo={};Re(fo,{API_PREFIX:()=>un,getScannerToken:()=>Ri,handleApi:()=>ki});function Ei(e){return e.headers.get("CF-Connecting-IP")??e.headers.get("x-forwarded-for")?.split(",")[0]?.trim()??"unknown"}function Ci(e,t){let n=ne.get(e);return n?t>=n.resetAt?(ne.delete(e),!1):n.count>=Pi:!1}function Ti(e,t){let n=ne.get(e);if(!n||t>=n.resetAt){if(ne.size>=co){for(let[r,o]of ne)t>=o.resetAt&&ne.delete(r);ne.size>=co&&ne.clear()}ne.set(e,{count:1,resetAt:t+uo});return}n.count+=1}function M(e,t=200,n={}){return new Response(JSON.stringify(e),{status:t,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store",...n}})}function W(e,t){return M({ok:!1,error:e},t)}async function Ri(e,t){let n=await e.get(Nt);if(n)return n;if(typeof t.SCANNER_TOKEN=="string"&&t.SCANNER_TOKEN)return t.SCANNER_TOKEN;let r=J(24);return await e.put(Nt,r),r}async function ki(e,t,n){if(!t.pathname.startsWith(un))return null;let{store:r,env:o,config:s,auth:i}=n,a=t.pathname.slice(un.length)||"/",c=e.method.toUpperCase();if(a==="/session"&&c==="GET"){let l=await $t(r,e);return M({ok:!0,authenticated:l,panelPath:i.panelPath})}if(a==="/login"&&c==="POST"){let l="";try{let y=await e.json();l=String(y.password??"")}catch{return W("\u8BF7\u6C42\u4F53\u89E3\u6790\u5931\u8D25",400)}if(!l)return W("\u8BF7\u8F93\u5165\u5BC6\u7801",400);let u=Ei(e),d=Date.now();if(Ci(u,d))return new Response(JSON.stringify({ok:!1,error:"\u5C1D\u8BD5\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(uo/1e3))}});let m=await Kr(i,l);if(!m.ok)return Ti(u,d),W("\u5BC6\u7801\u9519\u8BEF",401);ne.delete(u),m.legacy&&await zr(r,l).catch(()=>{}),await jr(r).catch(()=>{});let g=await Yr(r);return M({ok:!0},200,{"Set-Cookie":Xr(g)})}if(a==="/logout"&&c==="POST")return await Vr(r,e),M({ok:!0},200,{"Set-Cookie":Zr()});if(a==="/preferred-ips"&&c==="POST"){let l=e.headers.get("Authorization")??"",u=l.startsWith("Bearer ")?l.slice(7).trim():l.trim();if(!await Qr(r,u))return W("Token \u6821\u9A8C\u5931\u8D25",401);let m;try{m=await e.json()}catch{return W("\u8BF7\u6C42\u4F53\u89E3\u6790\u5931\u8D25",400)}let g=Array.isArray(m.ips)?m.ips.map(L=>String(L)):[],y=g.map(L=>L.trim()).filter(L=>L.length>0).join(`
|
|
6
|
+
`))}function Ar(e,t){let n=zt(t.config.subName);switch(e){case"clash":return{body:ni(t),contentType:"text/yaml; charset=utf-8",fileName:n};case"singbox":return{body:ri(t),contentType:"application/json; charset=utf-8",fileName:n};default:return{body:oi(t),contentType:"text/plain; charset=utf-8",fileName:n}}}var pe,Ns,Is,ir,ar,lr,Os,Ms,Bs,Vs,Qs,_s,de,qs,pr,hr,$s,gr,Wt=T(()=>{"use strict";ie();oe();Mt();sr();pe=443;Ns=["ip\u5730\u5740","ip \u5730\u5740","ip","\u5730\u5740","\u670D\u52A1\u5668","server","host"],Is=["\u7AEF\u53E3","port"],ir=["\u4E0B\u8F7D\u901F\u5EA6","\u901F\u5EA6","speed","download"],ar=["\u5E73\u5747\u5EF6\u8FDF","\u5EF6\u8FDF","latency","delay","\u54CD\u5E94\u65F6\u95F4","rtt"],lr=["colo","\u673A\u623F","\u6570\u636E\u4E2D\u5FC3","\u5730\u533A","region"],Os=["\u56FD\u5BB6","country","\u56FD\u522B"],Ms=["\u57CE\u5E02","city"],Bs=["tls","\u662F\u5426\u652F\u6301tls","\u652F\u6301tls"];Vs={official:"\u5B98\u65B9\u4F18\u9009IP",domain:"\u4F18\u9009\u57DF\u540D",manual:"\u624B\u52A8\u4F18\u9009IP",api:"\u8FDC\u7A0BAPI",csv:"\u6D4B\u901FCSV"};Qs=12e4,_s=32,de=new Map,qs="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36";pr=["vless-ws","vless-xhttp","trojan"];hr=["vless-ws","trojan"];$s=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;gr=".cn,qq.com,tencent.com,weixin.qq.com,baidu.com,bdstatic.com,bilibili.com,hdslb.com,taobao.com,tmall.com,jd.com,aliyun.com,alicdn.com,alipay.com,163.com,126.net,zhihu.com,weibo.com,sina.com.cn,youku.com,iqiyi.com,douyin.com,xiaohongshu.com,mi.com,huawei.com,csdn.net,gitee.com,cnblogs.com".split(",")});function di(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Rr(e,t){let n=await crypto.subtle.importKey("raw",Tr.encode(e),{name:"HMAC",hash:"SHA-256"},!1,["sign"]),r=await crypto.subtle.sign("HMAC",n,Tr.encode(t));return di(new Uint8Array(r))}async function lt(e){let t=(await e.get(at))?.trim();if(t)return t;let n=kr();return e instanceof se&&await e.put(at,n),n}async function Dr(e){let t=kr();return e instanceof se?await e.put(at,t):await e.put(at,t),t}async function vr(e,t={}){let n=t.ttlDays??0,r=Math.floor((t.now??Date.now())/1e3),o=n>0?r+Math.round(n*86400):0,s=Math.floor(Math.random()*36**8).toString(36).padStart(8,"0"),i=`${Zt}.${o.toString(36)}.${s}`,a=(await Rr(e,i)).slice(0,Vt);return`${i}.${a}`}async function ct(e,t,n=Date.now()){if(!e||!t)return{ok:!1,reason:"format"};let r=t.split(".");if(r.length!==4||r[0]!==Zt)return{ok:!1,reason:"format"};let o=r[1],s=r[2],i=r[3];if(!o||!s||i.length!==Vt)return{ok:!1,reason:"format"};let a=Number.parseInt(o,36);if(!Number.isFinite(a)||a<0)return{ok:!1,reason:"format"};let c=(await Rr(e,`${Zt}.${o}.${s}`)).slice(0,Vt);return q(i,c)?a>0&&Math.floor(n/1e3)>=a?{ok:!1,reason:"expired",exp:a}:{ok:!0,exp:a}:{ok:!1,reason:"signature"}}var at,Zt,Vt,Tr,kr,Jt=T(()=>{"use strict";_e();oe();at="SUB_TOKEN_SECRET",Zt="v1",Vt=22,Tr=new TextEncoder;kr=()=>J(32)});function gi(e){let t="";for(let n of e)t+=(n<16?"0":"")+n.toString(16);return t}function hi(e){if(!/^[0-9a-f]*$/.test(e)||e.length%2!==0)return null;let t=new Uint8Array(new ArrayBuffer(e.length/2));for(let n=0;n<t.length;n++)t[n]=Number.parseInt(e.slice(n*2,n*2+2),16);return t}async function Br(e,t,n){let r=hi(t);if(!r)return null;let o=await crypto.subtle.importKey("raw",new TextEncoder().encode(e),"PBKDF2",!1,["deriveBits"]),s=await crypto.subtle.deriveBits({name:"PBKDF2",salt:r,iterations:n,hash:"SHA-256"},o,256);return gi(new Uint8Array(s))}function Hr(e){if(e.startsWith(`${_t}$`)){let[r,o,s,i]=e.split("$");if(r!==_t||!s||!i)return null;let a=Number.parseInt(o??"",10);return!Number.isFinite(a)||a<1||a>1e6?null:{scheme:"pbkdf2",salt:s,iterations:a,expected:i}}let[t,n]=e.split(":");return!t||!n?null:{scheme:"sha256",salt:t,iterations:0,expected:n}}async function Fr(e,t){return e.scheme==="pbkdf2"?await Br(t,e.salt,e.iterations):await vt(`${e.salt}:${t}`)}async function qt(e,t){let n=await Br(e,t,Ir);return n?`${_t}$${Ir}$${t}$${n}`:`${t}:${await vt(`${t}:${e}`)}`}async function yi(e,t){let n=Hr(e);if(!n)return!1;let r=await Fr(n,t);return r?q(r,n.expected):!1}function Or(e){return`/${e.trim().replace(/^\/+/,"")}`}async function Gr(e,t,n){let r=await e.get(et)??"",o=n&&n.trim()?Or(n):"";o?r!==o&&(r=o,await e.put(et,r)):r||(r=Or(`${Xn}-${Kn(6)}`),await e.put(et,r));let s=await e.get(ke)??"",i=null,a=t&&t.trim()?t.trim():"";if(a){if(!s||!await yi(s,a)){let f=J(8);s=await qt(a,f),await e.put(ke,s)}await e.get(ye)&&await e.delete(ye)}else if(!s){let c=`cfp-${J(8)}`,f=J(8);s=await qt(c,f),await e.put(ke,s),i=c,await e.put(ye,c)}return{panelPath:r,passwordHash:s,generatedPassword:i}}async function Kr(e,t){let n=Hr(e.passwordHash);if(!n)return{ok:!1,legacy:!1};let r=await Fr(n,t);if(!r)return{ok:!1,legacy:!1};let o=q(r,n.expected);return{ok:o,legacy:o&&n.scheme==="sha256"}}async function zr(e,t){let n=J(8);await e.put(ke,await qt(t,n))}async function jr(e){await e.get(ye)&&await e.delete(ye)}function Wr(e){let t=e.headers.get("Cookie")??"",n={};for(let r of t.split(";")){let o=r.indexOf("=");if(o<0)continue;let s=r.slice(0,o).trim(),i=r.slice(o+1).trim();s&&(n[s]=decodeURIComponent(i))}return n}async function Yr(e){let t=J(24);return await e.put(`${$e}${t}`,JSON.stringify({ua:"",t:Date.now()}),Mr),t}async function $t(e,t){let n=Wr(t)[ft];return n?!!await e.get(`${$e}${n}`):!1}function Xr(e,t=Mr){return`${ft}=${e}; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=${t}`}function Zr(){return`${ft}=; Path=/; HttpOnly; Secure; SameSite=Strict; Max-Age=0`}async function Vr(e,t){let n=Wr(t)[ft];n&&await e.delete(`${$e}${n}`)}async function Jr(e){let t=J(20);return await e.put(`${qe}${t}`,"1",mi),t}async function Qr(e,t){if(!t)return!1;let n=await e.get("SCANNER_TOKEN");return n&&q(n,t)?!0:await e.get(`${qe}${t}`)?(await e.delete(`${qe}${t}`),!0):!1}var ft,Mr,mi,Ir,_t,en=T(()=>{"use strict";Ne();oe();ft="cfpilot_sess",Mr=3600*24,mi=600,Ir=3e4,_t="pbkdf2"});function tn(e){return jn(e)}async function dt(e,t){if(_.config&&Date.now()-_.configAt<bi)return _.config;let n=await Jn(e,t);return _.config=n,_.configAt=Date.now(),n}function _r(){_.config=null,_.configAt=0}async function nn(e,t){if(_.auth&&Date.now()-_.authAt<wi)return _.auth;let n=await Gr(e,t.PANEL_PASSWORD,t.PANEL_PATH);return _.auth=n,_.authAt=Date.now(),n}function rn(e){switch((e??"").toLowerCase()){case"clash":case"mihomo":case"yaml":return"clash";case"singbox":case"sing-box":case"json":return"singbox";case"v2ray":return"v2ray";case"base64":return"base64";default:return"base64"}}function Ge(e){let t=String(e??"").trim();if(!t)return t;t=t.replace(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//,""),t=t.replace(/[/?#].*$/,"");let n=t.lastIndexOf("@");if(n>=0&&(t=t.slice(n+1)),t.startsWith("[")){let r=t.indexOf("]");r>0&&(t=t.slice(1,r))}else{let r=t.indexOf(":");r>=0&&t.indexOf(":",r+1)<0&&(t=t.slice(0,r))}return t.trim()}function qr(e){let t=(e??"").toLowerCase();return t?t.includes("clash")||t.includes("mihomo")||t.includes("flclash")||t.includes("clashx")||t.includes("stash")?"clash":t.includes("sing-box")||t.includes("singbox")?"singbox":t.includes("v2ray")||t.includes("v2rayng")||t.includes("shadowrocket")||t.includes("nekobox")||t.includes("surge")||t.includes("loon")||t.includes("quantumult")?"base64":null:null}var bi,wi,_,pt=T(()=>{"use strict";_e();Ne();en();bi=15e3,wi=6e4,_={config:null,configAt:0,auth:null,authAt:0}});function on(e,t,n){if(!e){n.push({field:t,message:`${t} \u4E0D\u80FD\u4E3A\u7A7A`});return}if(!e.startsWith("/")){n.push({field:t,message:`${t} \u5FC5\u987B\u4EE5 / \u5F00\u5934`});return}if(e.length>128){n.push({field:t,message:`${t} \u8FC7\u957F\uFF08\u6700\u591A 128 \u5B57\u7B26\uFF09`});return}/[\s\u0000-\u001f]/.test(e)&&n.push({field:t,message:`${t} \u4E0D\u80FD\u5305\u542B\u7A7A\u683C\u6216\u63A7\u5236\u5B57\u7B26`})}function me(e,t,n,r,o){if(!Number.isFinite(e)){o.push({field:t,message:`${t} \u5FC5\u987B\u662F\u6570\u5B57`});return}(e<n||e>r)&&o.push({field:t,message:`${t} \u5FC5\u987B\u5728 ${n} ~ ${r} \u4E4B\u95F4\uFF08\u5F53\u524D ${e}\uFF09`})}function mt(e,t,n){let r=e.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>20){n.push({field:t,message:`${t} \u6700\u591A 20 \u6761\uFF08\u5F53\u524D ${r.length}\uFF09`});return}for(let o of r)if(!Si.test(o)){n.push({field:t,message:`${t} \u91CC\u6709\u65E0\u6CD5\u8BC6\u522B\u7684\u6761\u76EE\uFF1A${o.slice(0,40)}`});return}}function $r(e,t,n){let r=e.split(/\r?\n|,/).map(o=>o.trim()).filter(Boolean);if(r.length>10){n.push({field:t,message:`${t} \u6700\u591A 10 \u6761\uFF08\u5F53\u524D ${r.length}\uFF09`});return}for(let o of r)if(!/^https?:\/\/\S+$/i.test(o)){n.push({field:t,message:`${t} \u5FC5\u987B\u662F http(s) \u5730\u5740\uFF1A${o.slice(0,40)}`});return}}function sn(e){let t=[],n=o=>Object.prototype.hasOwnProperty.call(e,o);n("wsPath")&&on(String(e.wsPath??""),"wsPath",t),n("trojanPath")&&on(String(e.trojanPath??""),"trojanPath",t),n("xhttpPath")&&on(String(e.xhttpPath??""),"xhttpPath",t);let r=["wsPath","trojanPath","xhttpPath"].filter(o=>n(o)).map(o=>`${o}=${String(e[o]??"")}`);if(r.length>=2){let o=r.map(s=>s.slice(s.indexOf("=")+1));new Set(o).size!==o.length&&t.push({field:"paths",message:"wsPath / trojanPath / xhttpPath \u4E0D\u80FD\u91CD\u590D"})}if(n("subDomain")){let o=String(e.subDomain??"").trim();o&&(!xi.test(o)||o.includes("/"))&&t.push({field:"subDomain",message:"subDomain \u5FC5\u987B\u662F\u5408\u6CD5\u4E3B\u673A\u540D\uFF08\u4E0D\u542B\u534F\u8BAE\u4E0E\u8DEF\u5F84\uFF09"})}if(n("proxyIp")&&mt(String(e.proxyIp??""),"proxyIp",t),n("socks5")&&mt(String(e.socks5??""),"socks5",t),n("httpProxy")&&mt(String(e.httpProxy??""),"httpProxy",t),n("relayPool")&&mt(String(e.relayPool??""),"relayPool",t),n("officialCount")&&me(Number(e.officialCount),"officialCount",1,200,t),n("domainCount")&&me(Number(e.domainCount),"domainCount",1,200,t),n("maxNodes")&&me(Number(e.maxNodes),"maxNodes",0,500,t),n("dls")&&me(Number(e.dls),"dls",0,1e3,t),n("maxLatency")&&me(Number(e.maxLatency),"maxLatency",0,1e4,t),n("dataBudgetMB")&&me(Number(e.dataBudgetMB),"dataBudgetMB",0,102400,t),n("subTokenTtlDays")&&me(Number(e.subTokenTtlDays),"subTokenTtlDays",0,3650,t),n("subPorts")){let o=String(e.subPorts??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>6?t.push({field:"subPorts",message:"subPorts \u6700\u591A 6 \u4E2A\u7AEF\u53E3"}):s.every(i=>/^\d{1,5}$/.test(i)&&Number(i)>=1&&Number(i)<=65535)||t.push({field:"subPorts",message:"subPorts \u91CC\u6BCF\u4E2A\u7AEF\u53E3\u90FD\u5FC5\u987B\u662F 1~65535 \u7684\u6570\u5B57"})}}if(n("subName")){let o=String(e.subName??"");o.length>40&&t.push({field:"subName",message:"subName \u6700\u591A 40 \u5B57\u7B26"}),/[\u0000-\u001f]/.test(o)&&t.push({field:"subName",message:"subName \u4E0D\u80FD\u5305\u542B\u63A7\u5236\u5B57\u7B26"})}if(n("addApi")&&$r(String(e.addApi??""),"addApi",t),n("addCsv")&&$r(String(e.addCsv??""),"addCsv",t),n("uuid")){let o=String(e.uuid??"").trim();o&&!/^[0-9a-fA-F]{8}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{4}-?[0-9a-fA-F]{12}$/.test(o)&&t.push({field:"uuid",message:"uuid \u5FC5\u987B\u662F\u6807\u51C6 UUID\uFF0836 \u4F4D\uFF0C\u53EF\u5E26\u8FDE\u5B57\u7B26\uFF09"})}if(n("poolCountries")){let o=String(e.poolCountries??"").trim();if(o){let s=o.split(/[\n,;\s]+/).filter(Boolean);s.length>30?t.push({field:"poolCountries",message:"poolCountries \u6700\u591A 30 \u4E2A\u56FD\u5BB6/\u5730\u533A"}):s.every(i=>/^[A-Za-z]{2,3}$/.test(i))||t.push({field:"poolCountries",message:"poolCountries \u53EA\u80FD\u662F 2~3 \u4F4D\u5B57\u6BCD\u4EE3\u7801"})}}if(n("udpDnsEndpoint")){let o=String(e.udpDnsEndpoint??"").trim();o&&!/^https:\/\/\S+$/i.test(o)&&t.push({field:"udpDnsEndpoint",message:"udpDnsEndpoint \u5FC5\u987B\u662F https \u5730\u5740"})}return t}function an(e){return e.length===0?"":e.length===1?e[0].message:`\u6709 ${e.length} \u9879\u914D\u7F6E\u4E0D\u5408\u6CD5\uFF1A${e.map(t=>t.message).join("\uFF1B")}`}var xi,Si,eo=T(()=>{"use strict";xi=/^(?=.{1,253}$)([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)(\.[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,Si=/^(?:(?:socks5|socks|socks5h|http|https):\/\/)?(?:[^\s@/]+@)?(?:\[[0-9a-fA-F:]+\]|[A-Za-z0-9._-]+)(?::\d{1,5})?$/});function ro(e,t=Date.now()){let n={};for(let o of no){let s=e[o];s!==void 0&&(n[o]=s)}let r=Ai.map(o=>({field:o.field,reason:o.reason}));for(let o of["socks5","httpProxy"]){let s=String(e[o]??"");if(!s){n[o]="";continue}if(s.includes("@")){r.push({field:o,reason:"\u542B\u7528\u6237\u540D/\u53E3\u4EE4\uFF0C\u9700\u624B\u5DE5\u91CD\u65B0\u586B\u5199"});continue}n[o]=s}return{schemaVersion:1,exportedAt:new Date(t).toISOString(),config:n,omitted:r}}function oo(e){let t=new Set([...no.map(String),"socks5","httpProxy"]),n={};for(let[r,o]of Object.entries(e))t.has(r)&&(n[r]=o);return n}function to(e){if(e==null)return"\uFF08\u7A7A\uFF09";if(typeof e=="string"){let t=e.replace(/\s+/g," ").trim();return t.length>60?`${t.slice(0,60)}\u2026`:t||"\uFF08\u7A7A\uFF09"}return String(e)}function so(e,t){let n=[];for(let[r,o]of Object.entries(t)){let s=e[r];String(s)!==String(o)&&n.push({field:r,from:to(s),to:to(o)})}return n}var no,Ai,io=T(()=>{"use strict";no=["poolOfficial","officialCount","poolDomain","domainCount","poolManual","poolCountries","add","dls","maxLatency","maxNodes","proxyIp","relayPool","useBuiltinRelay","proxyMode","nat64","concurrentDial","dataBudgetMB","resolvePreferred","enableTrojan","enableXhttp","subProtocol","subTransport","subVariants","subName","subPorts","clientFingerprint","ech","echHost","echDns","tlsFragment","tlsFragmentSize","tlsFragmentDelay","subToken","subTokenTtlDays","unlockProbe","udpDns","udpDnsEndpoint"],Ai=[{field:"uuid",reason:"\u5165\u7AD9\u51ED\u636E"},{field:"trojanPassword",reason:"\u5165\u7AD9\u51ED\u636E"},{field:"wsPath",reason:"\u5B9E\u4F8B\u6807\u8BC6\uFF08\u8BA2\u9605\u94FE\u63A5\u91CC\u53EF\u89C1\uFF0C\u5BFC\u51FA\u5373\u66B4\u9732\u5165\u53E3\uFF09"},{field:"trojanPath",reason:"\u5B9E\u4F8B\u6807\u8BC6"},{field:"xhttpPath",reason:"\u5B9E\u4F8B\u6807\u8BC6"},{field:"subDomain",reason:"\u5B9E\u4F8B\u6807\u8BC6"},{field:"addApi",reason:"URL \u53EF\u80FD\u542B\u79C1\u6709 token"},{field:"addCsv",reason:"URL \u53EF\u80FD\u542B\u79C1\u6709 token"}]});function lo(){return new Response(JSON.stringify({build:Ke,version:ln,ts:Date.now()}),{status:200,headers:{"Content-Type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"}})}var Ke,ln,ao,cn=T(()=>{"use strict";Ke="56a28f5-6a8a5b51",ln="0.13.11",ao="/__cfp_version"});var fo={};Re(fo,{API_PREFIX:()=>un,getScannerToken:()=>Ri,handleApi:()=>ki});function Ei(e){return e.headers.get("CF-Connecting-IP")??e.headers.get("x-forwarded-for")?.split(",")[0]?.trim()??"unknown"}function Ci(e,t){let n=ne.get(e);return n?t>=n.resetAt?(ne.delete(e),!1):n.count>=Pi:!1}function Ti(e,t){let n=ne.get(e);if(!n||t>=n.resetAt){if(ne.size>=co){for(let[r,o]of ne)t>=o.resetAt&&ne.delete(r);ne.size>=co&&ne.clear()}ne.set(e,{count:1,resetAt:t+uo});return}n.count+=1}function M(e,t=200,n={}){return new Response(JSON.stringify(e),{status:t,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store",...n}})}function W(e,t){return M({ok:!1,error:e},t)}async function Ri(e,t){let n=await e.get(Nt);if(n)return n;if(typeof t.SCANNER_TOKEN=="string"&&t.SCANNER_TOKEN)return t.SCANNER_TOKEN;let r=J(24);return await e.put(Nt,r),r}async function ki(e,t,n){if(!t.pathname.startsWith(un))return null;let{store:r,env:o,config:s,auth:i}=n,a=t.pathname.slice(un.length)||"/",c=e.method.toUpperCase();if(a==="/session"&&c==="GET"){let l=await $t(r,e);return M({ok:!0,authenticated:l,panelPath:i.panelPath})}if(a==="/login"&&c==="POST"){let l="";try{let y=await e.json();l=String(y.password??"")}catch{return W("\u8BF7\u6C42\u4F53\u89E3\u6790\u5931\u8D25",400)}if(!l)return W("\u8BF7\u8F93\u5165\u5BC6\u7801",400);let u=Ei(e),d=Date.now();if(Ci(u,d))return new Response(JSON.stringify({ok:!1,error:"\u5C1D\u8BD5\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"}),{status:429,headers:{"Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store","Retry-After":String(Math.ceil(uo/1e3))}});let m=await Kr(i,l);if(!m.ok)return Ti(u,d),W("\u5BC6\u7801\u9519\u8BEF",401);ne.delete(u),m.legacy&&await zr(r,l).catch(()=>{}),await jr(r).catch(()=>{});let g=await Yr(r);return M({ok:!0},200,{"Set-Cookie":Xr(g)})}if(a==="/logout"&&c==="POST")return await Vr(r,e),M({ok:!0},200,{"Set-Cookie":Zr()});if(a==="/preferred-ips"&&c==="POST"){let l=e.headers.get("Authorization")??"",u=l.startsWith("Bearer ")?l.slice(7).trim():l.trim();if(!await Qr(r,u))return W("Token \u6821\u9A8C\u5931\u8D25",401);let m;try{m=await e.json()}catch{return W("\u8BF7\u6C42\u4F53\u89E3\u6790\u5931\u8D25",400)}let g=Array.isArray(m.ips)?m.ips.map(L=>String(L)):[],y=g.map(L=>L.trim()).filter(L=>L.length>0).join(`
|
|
7
7
|
`);await r.get(te)!==y&&await r.put(te,y);let w={};(s.add??"").trim()!==""&&(w.add=""),s.poolManual||(w.poolManual=!0);let S=!1;return Object.keys(w).length>0&&(await ve(r,De(s,w)),n.onConfigChanged(),S=w.add!==void 0),M({ok:!0,count:g.length,clearedManual:S,enabledManual:w.poolManual===!0})}if(!await $t(r,e))return W("\u672A\u767B\u5F55\u6216\u4F1A\u8BDD\u5DF2\u8FC7\u671F",401);if(a==="/status"&&c==="GET"){let l=await Ue(r),u=He(l),d=Ge(s.subDomain||o.DATA_HOST||t.hostname);return M({ok:!0,panelPath:i.panelPath,domain:t.hostname,nodeDomain:d,dataHost:o.DATA_HOST??"",colo:e.cf?.colo??"UNK",coloLabel:Me(e.cf?.colo??""),localIps:u.length,generatedPassword:i.generatedPassword,version:Ke,pkgVersion:ln,readAt:Date.now()})}if(a==="/config"&&c==="GET")return M({ok:!0,config:s});if(a==="/config"&&c==="PUT"){let l;try{l=await e.json()}catch{return W("\u8BF7\u6C42\u4F53\u89E3\u6790\u5931\u8D25",400)}if(!l.config||typeof l.config!="object")return W("\u7F3A\u5C11\u914D\u7F6E\u5BF9\u8C61",400);let u=sn(l.config);if(u.length>0)return W(an(u),400);let d=De(s,l.config);return await ve(r,d),n.onConfigChanged(),M({ok:!0,config:d})}if(a==="/config/export"&&c==="GET")return M({ok:!0,...ro(s)});if(a==="/config/import"&&c==="POST"){let l;try{l=await e.json()}catch{return W("\u8BF7\u6C42\u4F53\u89E3\u6790\u5931\u8D25",400)}if(!l.config||typeof l.config!="object")return W("\u7F3A\u5C11\u914D\u7F6E\u5BF9\u8C61",400);let u=oo(l.config);if(Object.keys(u).length===0)return W("\u6CA1\u6709\u53EF\u5BFC\u5165\u7684\u5B57\u6BB5\uFF08\u786E\u8BA4\u662F\u672C\u9879\u76EE\u5BFC\u51FA\u7684\u914D\u7F6E\u6587\u4EF6\uFF1F\uFF09",400);let d=sn(u);if(d.length>0)return W(an(d),400);let m=so(s,u);if(l.dryRun)return M({ok:!0,dryRun:!0,diff:m,count:m.length});if(m.length===0)return M({ok:!0,applied:0,diff:[],config:s});let g=De(s,u);return await ve(r,g),n.onConfigChanged(),M({ok:!0,applied:m.length,diff:m,config:g})}if(a==="/ips"&&c==="GET"){let l=await Ue(r),u=He(l);return M({ok:!0,raw:l,count:u.length,entries:u})}if(a==="/ips"&&c==="DELETE")return await r.delete(te),M({ok:!0});if(a==="/ips"&&c==="PUT"){let l;try{l=await e.json()}catch{return W("\u8BF7\u6C42\u4F53\u89E3\u6790\u5931\u8D25",400)}if(typeof l.raw!="string")return W("\u7F3A\u5C11 raw \u5B57\u6BB5",400);let u=l.raw.split(/\r?\n/).map(d=>d.trim()).filter(d=>d.length>0).join(`
|
|
8
8
|
`);return u?await r.put(te,u):await r.get(te)!==null&&await r.delete(te),M({ok:!0,count:u?u.split(`
|
|
9
9
|
`).length:0})}if(a==="/nodes"&&c==="GET"){let l=await Ue(r),u=await Le(r),d=new be(8),m=await st(s,l,{budget:d,domainPool:u.length>0?u:void 0,bypassRemoteCache:!0});return M({ok:!0,count:m.nodes.length,nodes:m.nodes.slice(0,200).map(g=>({...g,coloLabel:g.colo?Me(g.colo):""})),groups:m.groups.map(g=>({key:g.key,name:g.name,count:g.entries.length})),stats:m.stats})}if(a==="/pool/meta"&&c==="GET"){let l=await Le(r);return M({ok:!0,countries:nr.map(u=>({code:u,name:$n[u]??u})),limits:{officialCount:200,domainCount:100},builtin:{cidrs:tt.length,domains:Oe.length},customDomains:l})}if(a==="/pool/library"&&c==="PUT"){let l;try{l=await e.json()}catch{return W("\u8BF7\u6C42\u4F53\u89E3\u6790\u5931\u8D25",400)}let u=Array.isArray(l.domains)?l.domains.map(d=>String(d)):[];return await Qn(r,u),M({ok:!0,count:u.filter(d=>d.trim()).length})}if(a==="/scanner-token"&&c==="POST"){let l=await Jr(r);return M({ok:!0,token:l,expiresIn:600})}if(a==="/sub-token"&&(c==="GET"||c==="POST")){let l=c==="POST",u=l?await Dr(r):await lt(r),d=await vr(u,{ttlDays:s.subTokenTtlDays}),m=await ct(u,d);return M({ok:!0,rotated:l,mode:s.subToken,ttlDays:s.subTokenTtlDays,token:d,link:`${t.origin}/sub/${d}`,expiresAt:(m.exp??0)*1e3})}return a==="/events"&&c==="GET"?await Di(e,r):W("\u63A5\u53E3\u4E0D\u5B58\u5728",404)}async function Di(e,t){let n=new TextEncoder,r="",o,s=new ReadableStream({async start(i){let a=()=>{o&&clearTimeout(o);try{i.close()}catch{}};e.signal.addEventListener("abort",a);let c=async()=>{try{let f=await Ue(t);if(f!==r){r=f;let l=He(f).length;i.enqueue(n.encode(`event: ips
|
package/dist/cli.js
CHANGED
|
@@ -87,7 +87,7 @@ var VERSION, NAME;
|
|
|
87
87
|
var init_version = __esm({
|
|
88
88
|
"src/shared/version.ts"() {
|
|
89
89
|
"use strict";
|
|
90
|
-
VERSION = "0.13.
|
|
90
|
+
VERSION = "0.13.11";
|
|
91
91
|
NAME = "cfpilot";
|
|
92
92
|
}
|
|
93
93
|
});
|
|
@@ -788,16 +788,20 @@ var init_cf_api = __esm({
|
|
|
788
788
|
);
|
|
789
789
|
}
|
|
790
790
|
/**
|
|
791
|
-
* 开启 / 关闭脚本的 workers.dev
|
|
791
|
+
* 开启 / 关闭脚本的 workers.dev 子域路由与预览链接。
|
|
792
792
|
*
|
|
793
793
|
* 注意:Worker 上传成功后该路由默认是关闭的,必须显式传 enabled: true,
|
|
794
794
|
* 否则 https://<name>.<sub>.workers.dev/ 会一直返回「There is nothing here yet」。
|
|
795
|
+
*
|
|
796
|
+
* ⚠️ enabled 与 previewsEnabled 是**两个独立开关**:
|
|
797
|
+
* 真机事故(2026-11-02)—— 数据面绑了自定义域名后,
|
|
798
|
+
* workers.dev 的生产链接与预览链接必须**都关掉**,否则节点全部 -1。
|
|
795
799
|
*/
|
|
796
|
-
async putScriptSubdomain(accountId, scriptName, enabled = true) {
|
|
800
|
+
async putScriptSubdomain(accountId, scriptName, enabled = true, previewsEnabled = false) {
|
|
797
801
|
return await this.request(
|
|
798
802
|
"POST",
|
|
799
803
|
`/accounts/${encodeURIComponent(accountId)}/workers/scripts/${encodeURIComponent(scriptName)}/subdomain`,
|
|
800
|
-
{ enabled }
|
|
804
|
+
{ enabled, previews_enabled: previewsEnabled }
|
|
801
805
|
);
|
|
802
806
|
}
|
|
803
807
|
/**
|
|
@@ -1544,8 +1548,44 @@ async function preflightWorkersDataPlane(client, accountId, log, warnings) {
|
|
|
1544
1548
|
} catch {
|
|
1545
1549
|
}
|
|
1546
1550
|
}
|
|
1551
|
+
async function findNodeHostClash(client, accountId, controlProject, dataPlaneName, host) {
|
|
1552
|
+
const target = host.trim().toLowerCase();
|
|
1553
|
+
if (!target) return "";
|
|
1554
|
+
try {
|
|
1555
|
+
const domains = await client.listWorkerDomains(accountId);
|
|
1556
|
+
const bound = domains.find((dm) => dm.service === dataPlaneName && dm.hostname)?.hostname;
|
|
1557
|
+
if (bound && bound.trim().toLowerCase() !== target) {
|
|
1558
|
+
return `\u8282\u70B9\u57DF\u540D\u586B\u7684\u662F ${host}\uFF0C\u4F46\u6570\u636E\u9762 Worker \u5DF2\u7ED1\u5B9A\u7684\u81EA\u5B9A\u4E49\u57DF\u540D\u662F ${bound} \u2014\u2014 \u4E24\u8005\u5FC5\u987B\u4E00\u81F4
|
|
1559
|
+
\u2192 \u586B\u9519\u7684\u57DF\u540D\u4F1A\u88AB\u5199\u8FDB\u63A7\u5236\u9762 DATA_HOST\uFF0C\u8BA2\u9605\u8282\u70B9\u4F1A\u5168\u90E8\u8FDE\u4E0D\u4E0A\uFF1B
|
|
1560
|
+
\u2192 \u82E5\u8981\u6362\u57DF\u540D\uFF0C\u8BF7\u5148\u5230\u63A7\u5236\u53F0\u89E3\u7ED1\u65E7\u7684\u3001\u518D\u7ED1\u5B9A\u65B0\u7684\uFF0C\u7136\u540E\u586B\u65B0\u7684\u3002`;
|
|
1561
|
+
}
|
|
1562
|
+
} catch {
|
|
1563
|
+
}
|
|
1564
|
+
try {
|
|
1565
|
+
if (controlProject) {
|
|
1566
|
+
const project = await client.getPagesProject(accountId, controlProject);
|
|
1567
|
+
for (const domain of project.domains ?? []) {
|
|
1568
|
+
if (domain.trim().toLowerCase() === target) {
|
|
1569
|
+
return `\u8282\u70B9\u57DF\u540D ${host} \u662F**\u63A7\u5236\u9762**\u7684\u57DF\u540D\uFF0C\u4E0D\u80FD\u7528\u4F5C\u6570\u636E\u9762\u8282\u70B9\u57DF\u540D\uFF08\u63A7\u5236\u9762\u4E0D\u8F6C\u53D1\u4EE3\u7406\u6D41\u91CF\uFF0C\u8282\u70B9\u4F1A\u5168\u90E8\u8FDE\u4E0D\u4E0A\uFF09`;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
} catch {
|
|
1574
|
+
}
|
|
1575
|
+
try {
|
|
1576
|
+
const domains = await client.listWorkerDomains(accountId);
|
|
1577
|
+
for (const domain of domains) {
|
|
1578
|
+
if (domain.service !== dataPlaneName && domain.hostname.trim().toLowerCase() === target) {
|
|
1579
|
+
return `\u8282\u70B9\u57DF\u540D ${host} \u5DF2\u7ED1\u5B9A\u5728\u8D26\u53F7\u91CC\u7684\u53E6\u4E00\u4E2A Worker\uFF08${domain.service}\uFF09\u4E0A\uFF0C\u4E0D\u80FD\u540C\u65F6\u7528\u4F5C\u6570\u636E\u9762\u8282\u70B9\u57DF\u540D`;
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
} catch {
|
|
1583
|
+
}
|
|
1584
|
+
return "";
|
|
1585
|
+
}
|
|
1547
1586
|
async function deployWorkersDataPlane(options) {
|
|
1548
1587
|
const { client, accountId, name, log, warnings } = options;
|
|
1588
|
+
const dataHost = (options.dataHost ?? "").trim();
|
|
1549
1589
|
log(`\xB7 \u4E0A\u4F20 Workers \u6570\u636E\u9762\u811A\u672C ${name}`);
|
|
1550
1590
|
await client.uploadScript(accountId, name, {
|
|
1551
1591
|
mainModule: "worker.js",
|
|
@@ -1553,13 +1593,33 @@ async function deployWorkersDataPlane(options) {
|
|
|
1553
1593
|
compatibilityDate: WORKERS_COMPAT_DATE,
|
|
1554
1594
|
bindings: options.bindings
|
|
1555
1595
|
});
|
|
1596
|
+
let boundCustom = "";
|
|
1556
1597
|
try {
|
|
1557
|
-
await client.
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1598
|
+
const domains = await client.listWorkerDomains(accountId);
|
|
1599
|
+
const hit = domains.find((dm) => dm.service === name && dm.hostname);
|
|
1600
|
+
if (hit?.hostname) boundCustom = hit.hostname;
|
|
1601
|
+
} catch {
|
|
1602
|
+
}
|
|
1603
|
+
if (dataHost || boundCustom) {
|
|
1604
|
+
try {
|
|
1605
|
+
await client.putScriptSubdomain(accountId, name, false, false);
|
|
1606
|
+
log("\u2705 \u5DF2\u5173\u95ED workers.dev \u7684\u751F\u4EA7\u94FE\u63A5\u4E0E\u9884\u89C8\u94FE\u63A5\uFF08\u8282\u70B9\u8D70\u81EA\u5B9A\u4E49\u57DF\u540D\uFF09");
|
|
1607
|
+
} catch (err) {
|
|
1608
|
+
warnings.push(
|
|
1609
|
+
`\u5173\u95ED workers.dev \u94FE\u63A5\u5931\u8D25\uFF1A${err instanceof Error ? err.message : String(err)}
|
|
1610
|
+
\u2192 \u5230\u63A7\u5236\u53F0 \u2192 Workers \u2192 \u4F60\u7684\u811A\u672C \u2192 \u8BBE\u7F6E \u2192 \u57DF\u548C\u8DEF\u7531\uFF0C\u628A\u300C\u751F\u4EA7\u300D\u4E0E\u300C\u9884\u89C8\u300D\u90FD\u5173\u6389\uFF0C
|
|
1611
|
+
\u5426\u5219\u8282\u70B9\u4F1A\u5168\u90E8\u8FDE\u4E0D\u4E0A\uFF08\u771F\u673A\u4E8B\u6545 2026-11-02\uFF09\u3002`
|
|
1612
|
+
);
|
|
1613
|
+
}
|
|
1614
|
+
} else {
|
|
1615
|
+
try {
|
|
1616
|
+
await client.putScriptSubdomain(accountId, name, true, false);
|
|
1617
|
+
} catch (err) {
|
|
1618
|
+
warnings.push(
|
|
1619
|
+
`\u5F00\u542F workers.dev \u8DEF\u7531\u5931\u8D25\uFF1A${err instanceof Error ? err.message : String(err)}
|
|
1561
1620
|
\u2192 \u5230\u63A7\u5236\u53F0 \u2192 Workers \u2192 \u4F60\u7684\u811A\u672C \u2192 \u8BBE\u7F6E \u2192 \u57DF\u548C\u8DEF\u7531 \u91CC\u624B\u52A8\u5F00\u542F\u5373\u53EF\u3002`
|
|
1562
|
-
|
|
1621
|
+
);
|
|
1622
|
+
}
|
|
1563
1623
|
}
|
|
1564
1624
|
let subdomain = "";
|
|
1565
1625
|
try {
|
|
@@ -1567,14 +1627,26 @@ async function deployWorkersDataPlane(options) {
|
|
|
1567
1627
|
} catch {
|
|
1568
1628
|
}
|
|
1569
1629
|
const devHost = workersDevHost(name, subdomain);
|
|
1570
|
-
const
|
|
1571
|
-
|
|
1630
|
+
const host = dataHost ? resolveNodeHost(dataHost, devHost) : boundCustom || devHost;
|
|
1631
|
+
if (dataHost) {
|
|
1632
|
+
const clash = await findNodeHostClash(client, accountId, options.controlProject ?? "", name, dataHost);
|
|
1633
|
+
if (clash) {
|
|
1634
|
+
throw new Error(
|
|
1635
|
+
clash + "\n \u2192 \u8BF7\u6539\u6210\u6570\u636E\u9762 Worker \u81EA\u5DF1\u7684\u57DF\u540D\uFF1B\u786E\u8BA4\u662F\u5426\u5207\u6362\u8FC7\u8D26\u6237\u5BFC\u81F4\u8F93\u5165\u6846\u6B8B\u7559\u3002"
|
|
1636
|
+
);
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1572
1639
|
if (dataHost) {
|
|
1573
1640
|
warnings.push(
|
|
1574
1641
|
`\u63A7\u5236\u9762\u7684\u8282\u70B9\u57DF\u540D\u5DF2\u8BBE\u4E3A ${dataHost}\uFF08\u5199\u5165 DATA_HOST\uFF09\u3002
|
|
1575
1642
|
\u2192 \u5DE5\u5177\u4E0D\u4F1A\u66FF\u4F60\u7ED1\u5B9A\u57DF\u540D\uFF0C\u8BF7\u5230 Cloudflare \u63A7\u5236\u53F0 \u2192 Workers \u548C Pages \u2192 ${name} \u2192 \u300C\u57DF\u300D\u6807\u7B7E\u9875 \u2192 \u6DFB\u52A0\u81EA\u5B9A\u4E49\u57DF\u540D\uFF0C\u586B ${dataHost}
|
|
1576
1643
|
\u2192 \u6CA1\u7ED1\u5B9A\u4E4B\u524D\uFF0C\u8FD9\u4E2A\u57DF\u540D\u7684\u6D41\u91CF\u5230\u4E0D\u4E86 Worker\u3002`
|
|
1577
1644
|
);
|
|
1645
|
+
} else if (boundCustom) {
|
|
1646
|
+
warnings.push(
|
|
1647
|
+
`\u63A7\u5236\u9762\u7684\u8282\u70B9\u57DF\u540D\u5DF2\u8BBE\u4E3A ${boundCustom}\uFF08\u6570\u636E\u9762\u5DF2\u7ED1\u5B9A\u7684\u81EA\u5B9A\u4E49\u57DF\u540D\uFF0C\u5199\u5165 DATA_HOST\uFF09\u3002
|
|
1648
|
+
\u2192 workers.dev \u7684\u751F\u4EA7\u4E0E\u9884\u89C8\u94FE\u63A5\u5DF2\u5173\u95ED\uFF0C\u8282\u70B9\u53EA\u8D70\u8FD9\u4E2A\u81EA\u5B9A\u4E49\u57DF\u540D\u3002`
|
|
1649
|
+
);
|
|
1578
1650
|
} else {
|
|
1579
1651
|
warnings.push(
|
|
1580
1652
|
`\u672A\u586B\u5199\u8282\u70B9\u57DF\u540D\uFF0C\u63A7\u5236\u9762\u7684 DATA_HOST \u7528\u7684\u662F ${devHost}\u3002
|
|
@@ -2628,6 +2700,8 @@ async function deployPagesSplit(options) {
|
|
|
2628
2700
|
name: dataName,
|
|
2629
2701
|
code: dataCode,
|
|
2630
2702
|
dataHost: options.dataHost,
|
|
2703
|
+
// 控制面项目名:用于校验节点域名没有串到控制面 / 别的 Worker 上。
|
|
2704
|
+
controlProject: result.control.name,
|
|
2631
2705
|
bindings: workersBindings,
|
|
2632
2706
|
log,
|
|
2633
2707
|
warnings
|
|
@@ -6641,15 +6715,15 @@ scan \u9009\u9879:
|
|
|
6641
6715
|
url = \u53EA\u7528\u516C\u5F00\u6D4B\u901F\u5730\u5740\uFF08\u4EFB\u4F55\u9879\u76EE\u90FD\u80FD\u6D4B\uFF09
|
|
6642
6716
|
--speed-url <url> \u516C\u5F00\u6D4B\u901F\u5730\u5740\uFF0C\u9ED8\u8BA4 ${DEFAULT_SPEED_URL}
|
|
6643
6717
|
\u53EF\u6362\u6210\u4EFB\u610F\u8FD4\u56DE\u5927\u6587\u4EF6\u7684\u5730\u5740
|
|
6644
|
-
--speed-conns <n> \u6D4B\u901F\u5E76\u53D1\u8FDE\u63A5\u6570\uFF0C\u9ED8\u8BA4 8\uFF0C\u6700\u5927
|
|
6718
|
+
--speed-conns <n> \u6D4B\u901F\u5E76\u53D1\u8FDE\u63A5\u6570\uFF0C\u9ED8\u8BA4 8\uFF0C\u6700\u5927 8
|
|
6645
6719
|
\u8DE8\u5883\u94FE\u8DEF\u5355\u6761 TCP \u53D7\u4E22\u5305 / \u62E5\u585E\u7A97\u53E3\u9650\u5236\u3002\u5B9E\u6D4B\u540C\u4E00\u4E2A IP\uFF1A
|
|
6646
6720
|
1 \u6761 0.12 MB/s\u30013 \u6761 0.47\u30018 \u6761 1.15\u300116 \u6761 2.22 \u2014\u2014
|
|
6647
6721
|
\u7528 1~3 \u6761\u4F1A\u7CFB\u7EDF\u6027\u4F4E\u4F30 2~4 \u500D\uFF1B8 \u6761\u66F4\u8D34\u8FD1\u6D4F\u89C8\u5668\u771F\u5B9E\u884C\u4E3A
|
|
6648
|
-
--speed-duration <ms> \u6D4B\u901F\u65F6\u957F\uFF0C\u9ED8\u8BA4 6000
|
|
6722
|
+
--speed-duration <ms> \u6D4B\u901F\u65F6\u957F\uFF0C\u9ED8\u8BA4 6000\uFF0C\u6700\u5927 10000
|
|
6649
6723
|
\u524D 1 \u79D2\u7684\u6162\u542F\u52A8\u6837\u672C\u4F1A\u88AB\u4E22\u5F03\uFF0C\u53EA\u7EDF\u8BA1\u4E4B\u540E\u7684\u7A33\u6001\u541E\u5410
|
|
6650
6724
|
\u26A0\uFE0F \u6D41\u91CF\u5F00\u9500 \u2248 \u65F6\u957F \xD7 \u94FE\u8DEF\u901F\u7387 \xD7 \u8FDE\u63A5\u6570\uFF1A
|
|
6651
|
-
|
|
6652
|
-
\uFF0830 \u4E2A\u5019\u9009 \u2248
|
|
6725
|
+
8 \u6761\u8FDE\u63A5\u30016 \u79D2\u30011MB/s \u94FE\u8DEF\u4E0A\u7EA6 48MB/\u5019\u9009
|
|
6726
|
+
\uFF0830 \u4E2A\u5019\u9009 \u2248 1.4GB\uFF09\u3002\u6D41\u91CF\u654F\u611F\u65F6\u8C03\u5C0F\u5B83\u6216 --speed-limit
|
|
6653
6727
|
--speed-concurrency <n>
|
|
6654
6728
|
\u6D4B\u901F\u9636\u6BB5\u7684\u5019\u9009\u5E76\u884C\u6570\uFF0C\u9ED8\u8BA4 1\uFF08\u4E32\u884C\uFF09
|
|
6655
6729
|
\u5E26\u5BBD\u7531\u6574\u6761\u94FE\u8DEF\u5171\u4EAB\uFF1A\u5E76\u884C\u6D4B\u591A\u4E2A\u5019\u9009\u4F1A\u4E92\u76F8\u62A2\u5E26\u5BBD\uFF0C
|
|
@@ -7104,8 +7178,13 @@ ${NAME} v${VERSION}
|
|
|
7104
7178
|
// 并发连接数:跨境链路上单条 TCP 受丢包 / 拥塞窗口限制。
|
|
7105
7179
|
// 2026-10-28 直连实测同一个 IP:1 条 0.12 MB/s、3 条 0.47、8 条 1.15、16 条 2.22 ——
|
|
7106
7180
|
// 用 3 条会系统性低估 2~4 倍。默认 8 条,贴近浏览器/客户端的真实多连接行为。
|
|
7107
|
-
|
|
7108
|
-
|
|
7181
|
+
//
|
|
7182
|
+
// ⚠️ 上限收窄到 8:实测(2026-11-02)并发 32 条、每条 5MiB 保持 6 秒也零失败,
|
|
7183
|
+
// 说明并发本身不会被平台卸载;但连接数越多,单轮流量越大(30 候选 × 8 连接 ≈ 1.2GB/轮),
|
|
7184
|
+
// 所以按「够用且不过量」封顶。与桌面版一致(maxMeasureConnections = 8)。
|
|
7185
|
+
speedConnections: Math.min(8, Math.max(1, flagNumber(args, "speed-conns", 8))),
|
|
7186
|
+
// 测速时长:默认 6 秒,上限 10 秒(同样按流量收窄)。
|
|
7187
|
+
speedDurationMs: Math.min(1e4, Math.max(2e3, flagNumber(args, "speed-duration", 6e3))),
|
|
7109
7188
|
// 真实隧道校验(可选):给了凭据才会跑
|
|
7110
7189
|
uuid: flagString(args, "uuid"),
|
|
7111
7190
|
trojanPassword: flagString(args, "trojan-password"),
|