Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/cmliu/edgetunnel
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jan 7, 2025
2 parents 4cfbc28 + 5ba1450 commit 55fecbe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion _worker.js

Large diffs are not rendered by default.

16 changes: 7 additions & 9 deletions 明文源码.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ let socks5Address = '';
let parsedSocks5Address = {};
let enableSocks = false;

let fakeUserID;
let fakeHostName;
let noTLS = 'false';
const expire = 4102329600;//2099-12-31
let proxyIPs;
Expand Down Expand Up @@ -74,15 +72,15 @@ export default {
currentDate.setHours(0, 0, 0, 0);
const timestamp = Math.ceil(currentDate.getTime() / 1000);
const fakeUserIDMD5 = await 双重哈希(`${userID}${timestamp}`);
fakeUserID = [
const fakeUserID = [
fakeUserIDMD5.slice(0, 8),
fakeUserIDMD5.slice(8, 12),
fakeUserIDMD5.slice(12, 16),
fakeUserIDMD5.slice(16, 20),
fakeUserIDMD5.slice(20)
].join('-');

fakeHostName = `${fakeUserIDMD5.slice(6, 9)}.${fakeUserIDMD5.slice(13, 19)}`;
const fakeHostName = `${fakeUserIDMD5.slice(6, 9)}.${fakeUserIDMD5.slice(13, 19)}`;

proxyIP = env.PROXYIP || env.proxyip || proxyIP;
proxyIPs = await 整理(proxyIP);
Expand Down Expand Up @@ -160,14 +158,14 @@ export default {
},
});
} else if (路径 == `/${fakeUserID}`) {
const fakeConfig = await 生成配置信息(userID, request.headers.get('Host'), sub, 'CF-Workers-SUB', RproxyIP, url, env);
const fakeConfig = await 生成配置信息(userID, request.headers.get('Host'), sub, 'CF-Workers-SUB', RproxyIP, url, fakeUserID, fakeHostName, env);
return new Response(`${fakeConfig}`, { status: 200 });
} else if (url.pathname == `/${动态UUID}/edit` || 路径 == `/${userID}/edit`) {
const html = await KV(request, env);
return html;
} else if (url.pathname == `/${动态UUID}` || 路径 == `/${userID}`) {
await sendMessage(`#获取订阅 ${FileName}`, request.headers.get('CF-Connecting-IP'), `UA: ${UA}</tg-spoiler>\n域名: ${url.hostname}\n<tg-spoiler>入口: ${url.pathname + url.search}</tg-spoiler>`);
const 维列斯Config = await 生成配置信息(userID, request.headers.get('Host'), sub, UA, RproxyIP, url, env);
const 维列斯Config = await 生成配置信息(userID, request.headers.get('Host'), sub, UA, RproxyIP, url, fakeUserID, fakeHostName, env);
const now = Date.now();
//const timestamp = Math.floor(now / 1000);
const today = new Date(now);
Expand Down Expand Up @@ -1106,7 +1104,7 @@ function socks5AddressParser(address) {
* @param {boolean} isBase64 内容是否是Base64编码的
* @returns {string} 恢复真实信息后的内容
*/
function 恢复伪装信息(content, userID, hostName, isBase64) {
function 恢复伪装信息(content, userID, hostName, fakeUserID, fakeHostName, isBase64) {
if (isBase64) content = atob(content); // 如果内容是Base64编码的,先解码

// 使用正则表达式全局替换('g'标志)
Expand Down Expand Up @@ -1220,7 +1218,7 @@ const cmad = decodeURIComponent(atob('dGVsZWdyYW0lMjAlRTQlQkElQTQlRTYlQjUlODElRT
* @param {string} UA
* @returns {Promise<string>}
*/
async function 生成配置信息(userID, hostName, sub, UA, RproxyIP, _url, env) {
async function 生成配置信息(userID, hostName, sub, UA, RproxyIP, _url, fakeUserID, fakeHostName, env) {
if (sub) {
const match = sub.match(/^(?:https?:\/\/)?([^\/]+)/);
if (match) {
Expand Down Expand Up @@ -1544,7 +1542,7 @@ async function 生成配置信息(userID, hostName, sub, UA, RproxyIP, _url, env

if (_url.pathname == `/${fakeUserID}`) return content;

return 恢复伪装信息(content, userID, hostName, isBase64);
return 恢复伪装信息(content, userID, hostName, fakeUserID, fakeHostName, isBase64);

} catch (error) {
console.error('Error fetching content:', error);
Expand Down

0 comments on commit 55fecbe

Please sign in to comment.