Skip to content

Commit

Permalink
优化 CF随机节点生成逻辑,增加 Loon 订阅地址支持
Browse files Browse the repository at this point in the history
  • Loading branch information
cmliu committed Feb 23, 2025
1 parent 3d116cd commit 60087f4
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions 明文源码.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,20 @@ async function get特洛伊Config(password, hostName, sub, UA, RproxyIP, _url, f
if ((addresses.length + addressesapi.length + addressescsv.length) == 0) {
// 定义 Cloudflare IP 范围的 CIDR 列表
let cfips = [
'103.21.244.0/23',
'103.21.244.0/24',
'104.16.0.0/13',
'104.24.0.0/14',
'172.64.0.0/14',
'104.16.0.0/14',
'104.24.0.0/15',
'141.101.64.0/19',
'172.64.0.0/14',
'188.114.96.0/21',
'190.93.240.0/21',
'162.159.152.0/23',
'104.16.0.0/13',
'104.24.0.0/14',
'172.64.0.0/14',
'103.21.244.0/23',
'104.16.0.0/14',
'104.24.0.0/15',
'141.101.64.0/19',
Expand All @@ -734,7 +743,10 @@ async function get特洛伊Config(password, hostName, sub, UA, RproxyIP, _url, f
return randomIP.join('.');
}
addresses = addresses.concat('127.0.0.1:1234#CFnat');
addresses = addresses.concat(cfips.map(cidr => generateRandomIPFromCIDR(cidr) + '#CF随机节点'));
const randomPorts = httpsPorts.concat('443');
addresses = addresses.concat(
cfips.map(cidr => generateRandomIPFromCIDR(cidr) + ':' + randomPorts[Math.floor(Math.random() * randomPorts.length)] + '#CF随机节点' + String(counter++).padStart(2, '0'))
);
}
}

Expand Down Expand Up @@ -817,6 +829,9 @@ async function get特洛伊Config(password, hostName, sub, UA, RproxyIP, _url, f
singbox订阅地址:<br>
<a href="javascript:void(0)" onclick="copyToClipboard('https://${proxyhost}${hostName}/${password}?sb','qrcode_3')" style="color:blue;text-decoration:underline;cursor:pointer;">https://${proxyhost}${hostName}/${password}?sb</a><br>
<div id="qrcode_3" style="margin: 10px 10px 10px 10px;"></div>
loon订阅地址:<br>
<a href="javascript:void(0)" onclick="copyToClipboard('https://${proxyhost}${hostName}/${password}?loon','qrcode_5')" style="color:blue;text-decoration:underline;cursor:pointer;">https://${proxyhost}${hostName}/${password}?loon</a><br>
<div id="qrcode_5" style="margin: 10px 10px 10px 10px;"></div>
${surge}
<strong><a href="javascript:void(0);" id="noticeToggle" onclick="toggleNotice()">实用订阅技巧∨</a></strong><br>
<div id="noticeContent" class="notice-content" style="display: none;">
Expand Down Expand Up @@ -954,6 +969,9 @@ async function get特洛伊Config(password, hostName, sub, UA, RproxyIP, _url, f
} else if (userAgent.includes('surge') || _url.searchParams.has('surge')) {
url = `${subProtocol}://${subConverter}/sub?target=surge&ver=4&url=${encodeURIComponent(url)}&insert=false&config=${encodeURIComponent(subConfig)}&emoji=${subEmoji}&list=false&xudp=false&udp=false&tfo=false&expand=true&scv=true&fdn=false`;
isBase64 = false;
} else if (userAgent.includes('loon') || _url.searchParams.has('loon')) {
url = `${subProtocol}://${subConverter}/sub?target=loon&url=${encodeURIComponent(url)}&insert=false&config=${encodeURIComponent(subConfig)}&emoji=${subEmoji}&list=false&tfo=false&scv=true&fdn=false&sort=false&new_name=true`;
isBase64 = false;
}
}

Expand Down

0 comments on commit 60087f4

Please sign in to comment.