Skip to content

Commit

Permalink
Update trojan源码(请使用上面的_worker.js,本文件无法使用,仅供DIY).js
Browse files Browse the repository at this point in the history
  • Loading branch information
yonggekkk authored Dec 23, 2024
1 parent 1274f62 commit 22e27aa
Showing 1 changed file with 88 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
import { connect } from "cloudflare:sockets";

let Pswd = "trojan";
const proxyIPs = ["ts.hpc.tw"]; //ts.hpc.tw edgetunnel.anycast.eu.org bestproxy.onecf.eu.org cdn-all.xn--b6gac.eu.org cdn.xn--b6gac.eu.org proxy.xxxxxxxx.tk
const proxyIPs = ["\u0074\u0073\u002e\u0068\u0070\u0063\u002e\u0074\u0077"];
let cn_hostnames = [''];
let CDNIP = 'www.visa.com.sg'
let CDNIP = '\u0077\u0077\u0077\u002e\u0076\u0069\u0073\u0061\u002e\u0063\u006f\u006d\u002e\u0073\u0067'
// http_ip
let IP1 = 'www.visa.com'
let IP2 = 'cis.visa.com'
let IP3 = 'africa.visa.com'
let IP4 = 'www.visa.com.sg'
let IP5 = 'www.visaeurope.at'
let IP6 = 'www.visa.com.mt'
let IP7 = 'qa.visamiddleeast.com'
let IP1 = '\u0077\u0077\u0077\u002e\u0076\u0069\u0073\u0061\u002e\u0063\u006f\u006d'
let IP2 = '\u0063\u0069\u0073\u002e\u0076\u0069\u0073\u0061\u002e\u0063\u006f\u006d'
let IP3 = '\u0061\u0066\u0072\u0069\u0063\u0061\u002e\u0076\u0069\u0073\u0061\u002e\u0063\u006f\u006d'
let IP4 = '\u0077\u0077\u0077\u002e\u0076\u0069\u0073\u0061\u002e\u0063\u006f\u006d\u002e\u0073\u0067'
let IP5 = '\u0077\u0077\u0077\u002e\u0076\u0069\u0073\u0061\u0065\u0075\u0072\u006f\u0070\u0065\u002e\u0061\u0074'
let IP6 = '\u0077\u0077\u0077\u002e\u0076\u0069\u0073\u0061\u002e\u0063\u006f\u006d\u002e\u006d\u0074'
let IP7 = '\u0071\u0061\u002e\u0076\u0069\u0073\u0061\u006d\u0069\u0064\u0064\u006c\u0065\u0065\u0061\u0073\u0074\u002e\u0063\u006f\u006d'

// https_ip
let IP8 = 'usa.visa.com'
let IP9 = 'myanmar.visa.com'
let IP10 = 'www.visa.com.tw'
let IP11 = 'www.visaeurope.ch'
let IP12 = 'www.visa.com.br'
let IP13 = 'www.visasoutheasteurope.com'
let IP8 = '\u0075\u0073\u0061\u002e\u0076\u0069\u0073\u0061\u002e\u0063\u006f\u006d'
let IP9 = '\u006d\u0079\u0061\u006e\u006d\u0061\u0072\u002e\u0076\u0069\u0073\u0061\u002e\u0063\u006f\u006d'
let IP10 = '\u0077\u0077\u0077\u002e\u0076\u0069\u0073\u0061\u002e\u0063\u006f\u006d\u002e\u0074\u0077'
let IP11 = '\u0077\u0077\u0077\u002e\u0076\u0069\u0073\u0061\u0065\u0075\u0072\u006f\u0070\u0065\u002e\u0063\u0068'
let IP12 = '\u0077\u0077\u0077\u002e\u0076\u0069\u0073\u0061\u002e\u0063\u006f\u006d\u002e\u0062\u0072'
let IP13 = '\u0077\u0077\u0077\u002e\u0076\u0069\u0073\u0061\u0073\u006f\u0075\u0074\u0068\u0065\u0061\u0073\u0074\u0065\u0075\u0072\u006f\u0070\u0065\u002e\u0063\u006f\u006d'

// http_port
let PT1 = '80'
Expand Down Expand Up @@ -539,6 +539,11 @@ function gettrojanConfig(Pswd, hostName) {
const pty = `https://${hostName}/${Pswd}/pty`
const pcl = `https://${hostName}/${Pswd}/pcl`
const psb = `https://${hostName}/${Pswd}/psb`

const wktrojanshare = btoa(`trojan://${Pswd}\u0040${IP1}:${PT1}?encryption=none&security=none&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T1_${IP1}_${PT1}\ntrojan://${Pswd}\u0040${IP2}:${PT2}?encryption=none&security=none&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T2_${IP2}_${PT2}\ntrojan://${Pswd}\u0040${IP3}:${PT3}?encryption=none&security=none&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T3_${IP3}_${PT3}\ntrojan://${Pswd}\u0040${IP4}:${PT4}?encryption=none&security=none&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T4_${IP4}_${PT4}\ntrojan://${Pswd}\u0040${IP5}:${PT5}?encryption=none&security=none&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T5_${IP5}_${PT5}\ntrojan://${Pswd}\u0040${IP6}:${PT6}?encryption=none&security=none&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T6_${IP6}_${PT6}\ntrojan://${Pswd}\u0040${IP7}:${PT7}?encryption=none&security=none&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T7_${IP7}_${PT7}\ntrojan://${Pswd}\u0040${IP8}:${PT8}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T8_${IP8}_${PT8}\ntrojan://${Pswd}\u0040${IP9}:${PT9}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T9_${IP9}_${PT9}\ntrojan://${Pswd}\u0040${IP10}:${PT10}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T10_${IP10}_${PT10}\ntrojan://${Pswd}\u0040${IP11}:${PT11}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T11_${IP11}_${PT11}\ntrojan://${Pswd}\u0040${IP12}:${PT12}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T12_${IP12}_${PT12}\ntrojan://${Pswd}\u0040${IP13}:${PT13}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T13_${IP13}_${PT13}`);

const pgtrojanshare = btoa(`trojan://${Pswd}\u0040${IP8}:${PT8}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T8_${IP8}_${PT8}\ntrojan://${Pswd}\u0040${IP9}:${PT9}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T9_${IP9}_${PT9}\ntrojan://${Pswd}\u0040${IP10}:${PT10}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T10_${IP10}_${PT10}\ntrojan://${Pswd}\u0040${IP11}:${PT11}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T11_${IP11}_${PT11}\ntrojan://${Pswd}\u0040${IP12}:${PT12}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T12_${IP12}_${PT12}\ntrojan://${Pswd}\u0040${IP13}:${PT13}?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2560#CF_T13_${IP13}_${PT13}`);

const noteshow = note.replace(/\n/g, '<br>');
const displayHtml = `
<head>
Expand Down Expand Up @@ -577,7 +582,7 @@ ${displayHtml}
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Cloudflare-workers/pages-trojan代理脚本 V24.12.22</h1>
<h1>Cloudflare-workers/pages-trojan代理脚本 V24.12.13</h1>
<hr>
<p>${noteshow}</p>
<hr>
Expand Down Expand Up @@ -652,6 +657,21 @@ ${displayHtml}
<hr>
<p>注意:<br>1、默认每个订阅链接包含TLS+非TLS共13个端口节点 (Clash节点仅6个TLS节点)<br>2、当前workers域名作为订阅链接,需通过代理进行订阅更新<br>3、如使用的客户端不支持分片功能,则TLS节点不可用</p>
<hr>
<table class="table">
<thead>
<tr>
<th>聚合通用分享链接 (可直接导入客户端,80系非tls节点在某些客户端可能被强制开启TLS,且不可用):</th>
</tr>
</thead>
<tbody>
<tr>
<td><button class="btn btn-primary" onclick="copyToClipboard('${wktrojanshare}')">点击复制链接</button></td>
</tr>
</tbody>
</table>
<table class="table">
<thead>
<tr>
Expand Down Expand Up @@ -709,7 +729,7 @@ ${displayHtml}
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Cloudflare-workers/pages-trojan代理脚本 V24.12.22</h1>
<h1>Cloudflare-workers/pages-trojan代理脚本 V24.12.13</h1>
<hr>
<p>${noteshow}</p>
<hr>
Expand Down Expand Up @@ -753,6 +773,21 @@ ${displayHtml}
<hr>
<p>注意:以下订阅链接仅6个TLS端口节点</p>
<hr>
<table class="table">
<thead>
<tr>
<th>聚合通用分享链接 (可直接导入客户端):</th>
</tr>
</thead>
<tbody>
<tr>
<td><button class="btn btn-primary" onclick="copyToClipboard('${pgtrojanshare}')">点击复制链接</button></td>
</tr>
</tbody>
</table>
<table class="table">
<thead>
<tr>
Expand Down Expand Up @@ -997,10 +1032,6 @@ return `{
"address": "h3://223.5.5.5/dns-query",
"detour": "direct"
},
{
"address": "rcode://refused",
"tag": "block"
},
{
"tag": "dns_fakeip",
"address": "fakeip"
Expand Down Expand Up @@ -1048,8 +1079,11 @@ return `{
"inbounds": [
{
"type": "tun",
"inet4_address": "172.19.0.1/30",
"inet6_address": "fd00::1/126",
"tag": "tun-in",
"address": [
"172.19.0.1/30",
"fd00::1/126"
],
"auto_route": true,
"strict_route": true,
"sniff": true,
Expand Down Expand Up @@ -1345,14 +1379,6 @@ return `{
"tag": "direct",
"type": "direct"
},
{
"tag": "block",
"type": "block"
},
{
"tag": "dns-out",
"type": "dns"
},
{
"tag": "auto",
"type": "urltest",
Expand Down Expand Up @@ -1407,10 +1433,19 @@ return `{
"auto_detect_interface": true,
"final": "select",
"rules": [
{
"outbound": "dns-out",
"protocol": "dns"
},
{
"inbound": "tun-in",
"action": "sniff"
},
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"port": 443,
"network": "udp",
"action": "reject"
},
{
"clash_mode": "Direct",
"outbound": "direct"
Expand Down Expand Up @@ -1640,10 +1675,6 @@ return `{
"address": "h3://223.5.5.5/dns-query",
"detour": "direct"
},
{
"address": "rcode://refused",
"tag": "block"
},
{
"tag": "dns_fakeip",
"address": "fakeip"
Expand Down Expand Up @@ -1691,8 +1722,11 @@ return `{
"inbounds": [
{
"type": "tun",
"inet4_address": "172.19.0.1/30",
"inet6_address": "fd00::1/126",
"tag": "tun-in",
"address": [
"172.19.0.1/30",
"fd00::1/126"
],
"auto_route": true,
"strict_route": true,
"sniff": true,
Expand Down Expand Up @@ -1869,14 +1903,6 @@ return `{
"tag": "direct",
"type": "direct"
},
{
"tag": "block",
"type": "block"
},
{
"tag": "dns-out",
"type": "dns"
},
{
"tag": "auto",
"type": "urltest",
Expand Down Expand Up @@ -1924,10 +1950,19 @@ return `{
"auto_detect_interface": true,
"final": "select",
"rules": [
{
"outbound": "dns-out",
"protocol": "dns"
},
{
"inbound": "tun-in",
"action": "sniff"
},
{
"protocol": "dns",
"action": "hijack-dns"
},
{
"port": 443,
"network": "udp",
"action": "reject"
},
{
"clash_mode": "Direct",
"outbound": "direct"
Expand Down

0 comments on commit 22e27aa

Please sign in to comment.