Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 1 #1

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
46444ee
See https://github.com/ansoncloud8/am-cf-tunnel/commit/a9f6cf481eecf1…
Aug 12, 2024
ae9c066
Merge branch 'ansoncloud8:main' into main
amclubs Aug 12, 2024
2989f27
See https://github.com/ansoncloud8/am-cf-tunnel/commit/032167eca317fc…
Aug 12, 2024
34133fb
Automatically package and commit _worker.js.zip
Aug 12, 2024
7980e31
See https://github.com/ansoncloud8/am-cf-tunnel/commit/4cf2fb943ceaf3…
Aug 29, 2024
1a3605b
See https://github.com/ansoncloud8/am-cf-tunnel/commit/f50e76e05efc10…
Aug 29, 2024
86bda71
See https://github.com/ansoncloud8/am-cf-tunnel/commit/09441ba4631aaf…
Aug 29, 2024
d6c7b8e
See https://github.com/ansoncloud8/am-cf-tunnel/commit/d2e44588d5b211…
Aug 29, 2024
3928391
See https://github.com/ansoncloud8/am-cf-tunnel/commit/36d00d543530b6…
Aug 29, 2024
a27e884
See https://github.com/ansoncloud8/am-cf-tunnel/commit/eeecbebc37d93e…
Aug 29, 2024
21c084e
See https://github.com/ansoncloud8/am-cf-tunnel/commit/abf9bfc87d3d5d…
Aug 29, 2024
65d85a5
See https://github.com/ansoncloud8/am-cf-tunnel/commit/b55d57d55a0f35…
Aug 30, 2024
8586064
See https://github.com/ansoncloud8/am-cf-tunnel/commit/fb49b173418bf9…
Aug 30, 2024
a2729d8
See https://github.com/ansoncloud8/am-cf-tunnel/commit/73da690108ed7c…
Aug 30, 2024
e57d0f0
See https://github.com/ansoncloud8/am-cf-tunnel/commit/33d3e132d6f198…
Aug 30, 2024
d8be658
See https://github.com/ansoncloud8/am-cf-tunnel/commit/54bbccbeabe7b6…
Aug 31, 2024
4f3e625
See https://github.com/ansoncloud8/am-cf-tunnel/commit/07b15981a30a18…
Aug 31, 2024
2dd07c2
Automatically package and commit _worker.js.zip
Aug 31, 2024
81724f9
See https://github.com/ansoncloud8/am-cf-tunnel/commit/cd946523c05098…
Aug 31, 2024
86dacb1
Automatically package and commit _worker.js.zip
Aug 31, 2024
4c9afc1
See https://github.com/ansoncloud8/am-cf-tunnel/commit/04294a9ff38b8a…
Aug 31, 2024
a884d2c
See https://github.com/ansoncloud8/am-cf-tunnel/commit/7cde92ad0a14bf…
Aug 31, 2024
fa45202
See https://github.com/ansoncloud8/am-cf-tunnel/commit/bfb7ac014afb6f…
Aug 31, 2024
dd62910
See https://github.com/ansoncloud8/am-cf-tunnel/commit/6668bf7d4bd1c0…
Aug 31, 2024
545ae42
Update README.md
ansoncloud8 Sep 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 53 additions & 64 deletions README.md

Large diffs are not rendered by default.

166 changes: 141 additions & 25 deletions _worker.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**
*- Telegram交流群:https://t.me/AM_CLUBS
*- YouTube频道:https://youtube.com/@AM_CLUB
*- VLESS订阅地址:https://worker.amcloud.filegear-sg.me/866853eb-5293-4f09-bf00-e13eb237c655
*- Github仓库地址:https://github.com/ansoncloud8
*- Github仓库地址:https://github.com/amclubsamclubs
**/
// @ts-ignore
import { connect } from 'cloudflare:sockets';
Expand All @@ -18,7 +17,7 @@ let proxyIP = '';//

let sub = '';// 留空则使用内置订阅
let subconverter = 'url.v1.mk';// clash订阅转换后端,自带虚假uuid和host订阅。
let subconfig = "https://raw.githubusercontent.com/ansoncloud8/ACL4SSR/main/Clash/config/ACL4SSR_Online_Full_MultiMode.ini"; //订阅配置文件
let subconfig = "https://raw.githubusercontent.com/amclubs/ACL4SSR/main/Clash/config/ACL4SSR_Online_Full_MultiMode.ini"; //订阅配置文件
let subProtocol = 'https';
// The user name and password do not contain special characters
// Setting the address will ignore proxyIP
Expand All @@ -40,12 +39,12 @@ const expire = 4102329600;//2099-12-31

// 设置优选地址,不带端口号默认443,TLS订阅生成
let addresses = [
'icook.tw:443#t.me/AM_CLUBS',//官方优选域名
'icook.hk:443#t.me/AM_CLUBS',//官方优选域名
//'cloudflare.cfgo.cc:443#关注YouTube频道@AM_CLUB',
'visa.com:443#youtube.com/@AM_CLUB'
];
// 设置优选地址api接口
let addressesapi = ['https://raw.githubusercontent.com/ansoncloud8/am-tunnel/dev/ipv4.txt'];
let addressesapi = ['https://raw.githubusercontent.com/amclubs/am-cf-tunnel/main/ipv4.txt'];

let addressesnotls = [];
let addressesnotlsapi = [];
Expand All @@ -55,7 +54,7 @@ let FileName = 'am-cf-tunnel';
let BotToken ='';
let ChatID ='';
let proxyhosts = [];//本地代理域名池
let proxyhostsURL = 'https://github.com/ansoncloud8/am-cf-trojan/blob/main/proxyhosts.txt';//在线代理域名池URL
let proxyhostsURL = 'https://raw.githubusercontent.com/amclubs/am-cf-auto-trojan/main/proxyhosts.txt';//在线代理域名池URL
let RproxyIP = 'false';


Expand Down Expand Up @@ -132,7 +131,14 @@ export default {
const URL = URLs[Math.floor(Math.random() * URLs.length)];
return envKey === 'URL302' ? Response.redirect(URL, 302) : fetch(new Request(URL, request));
}
return new Response(JSON.stringify(request.cf, null, 4), { status: 200 });
// return new Response(JSON.stringify(request.cf, null, 4), { status: 200 });
// 首页改成一个nginx伪装页
return new Response(await nginx(), {
headers: {
'Content-Type': 'text/html; charset=UTF-8',
'referer': 'https://www.google.com/search?q=am.809098.xyz',
},
});
case `/${fakeUserID}`:
const fakeConfig = await getVLESSConfig(userID, request.headers.get('Host'), sub, 'CF-Workers-SUB', RproxyIP, url);
return new Response(`${fakeConfig}`, { status: 200 });
Expand All @@ -141,10 +147,10 @@ export default {
if ((!sub || sub == '') && (addresses.length + addressesapi.length + addressesnotls.length + addressesnotlsapi.length + addressescsv.length) == 0){
if (request.headers.get('Host').includes(".workers.dev")) {
sub = 'worker.amcloud.filegear-sg.me';
subconfig = env.SUBCONFIG || 'https://raw.githubusercontent.com/ansoncloud8/ACL4SSR/main/Clash/config/ACL4SSR_Online_Full.ini';
subconfig = env.SUBCONFIG || 'https://raw.githubusercontent.com/amclubs/ACL4SSR/main/Clash/config/ACL4SSR_Online_Full.ini';
} else {
sub = 'worker.amcloud.filegear-sg.me';
subconfig = env.SUBCONFIG || "https://raw.githubusercontent.com/ansoncloud8/ACL4SSR/main/Clash/config/ACL4SSR_Online_Full_MultiMode.ini";
subconfig = env.SUBCONFIG || "https://raw.githubusercontent.com/amclubs/ACL4SSR/main/Clash/config/ACL4SSR_Online_Full_MultiMode.ini";
}
}
const vlessConfig = await getVLESSConfig(userID, request.headers.get('Host'), sub, UA, RproxyIP, url);
Expand Down Expand Up @@ -177,7 +183,7 @@ export default {
return new Response(`${vlessConfig}`, {
status: 200,
headers: {
"Content-Type": "text/plain;charset=utf-8",
"Content-Type": "text/html;charset=utf-8",
"Profile-Update-Interval": "6",
"Subscription-Userinfo": `upload=${pagesSum}; download=${workersSum}; total=${total}; expire=${expire}`,
}
Expand Down Expand Up @@ -1314,26 +1320,81 @@ async function getVLESSConfig(userID, hostName, sub, UA, RproxyIP, _url) {
let 订阅器 = `您的订阅内容由 ${sub} 提供维护支持, 自动获取ProxyIP: ${RproxyIP}`;
if (!sub || sub == '') {
if (!proxyIP || proxyIP =='') {
订阅器 = '您的订阅内容由 内置 addresses/ADD 参数提供, 当前使用的ProxyIP为空, 推荐您设置 proxyIP/PROXYIP !!!';
订阅器 = '您的订阅内容由 内置 addresses/ADD 参数提供, 当前使用的ProxyIP为空, 推荐您设置PROXYIP变量或订阅连接带proxyIP';
} else {
订阅器 = `您的订阅内容由 内置 addresses/ADD 参数提供, 当前使用的ProxyIP: ${proxyIPs.join(', ')}`;
}
} else if (RproxyIP != 'true'){
if (enableSocks) 订阅器 += `, 当前使用的Socks5: ${parsedSocks5Address.hostname}:${String(parsedSocks5Address.port)}`;
else 订阅器 += `, 当前使用的ProxyIP: ${proxyIPs.join(', ')}`;
}
return `
################################################################
telegram 交流群 技术大佬~在线交流!
t.me/AM_CLUBS
---------------------------------------------------------------
github 项目地址 点击Star!Star!Star!!!
https://github.com/ansoncloud8/am-tunnel
---------------------------------------------------------------
订阅YouTube频道,更多技术分享
https://youtube.com/@AM_CLUB

// HTML Head with CSS and FontAwesome library
const htmlHead = `
<head>
<title>am-cf-tunnel: VLESS configuration</title>
<meta name='description' content='AM科技 This is a tool for generating VLESS protocol configurations. Give us a star on GitHub https://github.com/amclubs if you found it useful!'>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
color: #333;
padding: 0px;
}

a {
color: #1a0dab;
text-decoration: none;
}
img {
max-width: 100%;
height: auto;
}

pre {
white-space: pre-wrap;
word-wrap: break-word;
background-color: #fff;
border: 1px solid #ddd;
padding: 0px;
margin: 0px 0;
}
/* Dark mode */
@media (prefers-color-scheme: dark) {
body {
background-color: #333;
color: #f0f0f0;
}

a {
color: #9db4ff;
}

pre {
background-color: #282a36;
border-color: #6272a4;
}
}
</style>

<!-- Add FontAwesome library -->
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css'>
</head>
`;

// Prepare header string
const header = `
<p align='center'>
<a href='t.me/AM_CLUBS' target='_blank'>t.me/AM_CLUBS 点击加入Telegram交流群 技术大佬~在线交流!!!</a>
<a href='https://github.com/amclubs/am-cf-tunnel' target='_blank'>https://github.com/amclubs 点击进入GitHub项目地址 点击Star!Star!Star!!!</a>
<a href='https://youtube.com/@AM_CLUB' target='_blank'>https://youtube.com/@AM_CLUB 点击进入YouTube频道,订阅频道,更多技术分享!!!</a>
</p>
`;

// return `
const output = `
################################################################
Subscribe / sub 订阅地址, 支持 Base64、clash-meta、sing-box 订阅格式, ${订阅器}
Subscribe / sub 订阅地址, 支持 Base64、clash-meta、sing-box、Quantumult X、小火箭、surge 等订阅格式, ${订阅器}
---------------------------------------------------------------
快速自适应订阅地址:
https://${proxyhost}${hostName}/${userID}
Expand Down Expand Up @@ -1362,6 +1423,29 @@ ${clash}
---------------------------------------------------------------
################################################################
`;


return `
<html>
${htmlHead}
<body>
<pre style="background-color: transparent; border: none; display: inline-block; white-space: pre-wrap; text-align: left;">${header}</pre>
<pre>${output}</pre>
</body>
<script>
function copyToClipboard(text) {
navigator.clipboard.writeText(text)
.then(() => {
alert("Copied to clipboard");
})
.catch((err) => {
console.error("Failed to copy to clipboard:", err);
});
}
</script>
</html>`;


} else {
if (typeof fetch != 'function') {
return 'Error: fetch is not available in this environment.';
Expand Down Expand Up @@ -1389,7 +1473,7 @@ ${clash}
fakeHostName = `${fakeHostName}.xyz`
}
console.log(`虚假HOST: ${fakeHostName}`);
let url = `${subProtocol}://${sub}/sub?host=${fakeHostName}&uuid=${fakeUserID}&tunnel=ansoncloud8&proxyip=${RproxyIP}`;
let url = `${subProtocol}://${sub}/sub?host=${fakeHostName}&uuid=${fakeUserID}&tunnel=amclubs&proxyip=${RproxyIP}`;
let isBase64 = true;

if (!sub || sub == ""){
Expand Down Expand Up @@ -1441,7 +1525,7 @@ ${clash}
} else {
const response = await fetch(url ,{
headers: {
'User-Agent': `${UA} CF-Workers-tunnel/ansoncloud8`
'User-Agent': `${UA} am-cf-tunnel/amclubs`
}});
content = await response.text();
}
Expand Down Expand Up @@ -1558,7 +1642,7 @@ async function getAddressesapi(api) {
method: 'get',
headers: {
'Accept': 'text/html,application/xhtml+xml,application/xml;',
'User-Agent': 'CF-Workers-tunnel/ansoncloud8'
'User-Agent': 'am-cf-tunnel/amclubs'
},
signal: controller.signal // 将AbortController的信号量添加到fetch请求中,以便于需要时可以取消请求
}).then(response => response.ok ? response.text() : Promise.reject())));
Expand Down Expand Up @@ -1826,3 +1910,35 @@ function isValidIPv4(address) {
const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
return ipv4Regex.test(address);
}


async function nginx() {
const text = `
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
`
return text;
}
Binary file modified _worker.js.zip
Binary file not shown.
74 changes: 25 additions & 49 deletions ipv4.txt
Original file line number Diff line number Diff line change
@@ -1,66 +1,42 @@
172.84.92.152:58723#US
154.21.91.6:15390#US
198.62.62.156:443#US
65.75.194.96:23190#US
166.1.157.124:443#US
23.94.137.117:443#US
103.35.189.61:8444#US
99.83.209.185:443#US
172.84.92.108:42304#US
174.136.206.95:57757#US
104.18.153.36:8443#US
104.17.206.71:443#US
116.204.210.11:443#HK
38.47.122.72:443#HK
8.218.143.10:2053#HK
47.243.90.180:2053#HK
38.150.15.137:443#HK
154.17.5.18:49887#US
119.28.189.227:32079#HK
103.30.78.25:30277#HK
38.180.150.193:2053#HK
47.236.253.41:2087#SG
47.237.84.173:8443#SG
47.236.237.90:8443#SG
43.156.37.138:5555#SG
47.236.180.51:2083#SG
47.236.180.24:2053#SG
47.236.202.91:2083#SG
43.156.143.198:40809#SG
43.159.55.220:34237#SG
168.138.179.107:36322#SG
43.134.187.193:8989#SG
1150.230.107.234:47236#JP
138.2.12.10:45805#JP
103.232.214.11:8443#JP
35.200.25.49:2087#JP
58.176.95.46:443#HK
116.204.210.11:443#HK
47.243.90.180:2053#HK
101.36.111.171:34237#HK
47.237.86.185:2087#HK
54.169.229.188:443#SG
47.236.237.90:2053#SG
129.150.32.171:6443#SG
54.169.229.188:443#SG
47.237.86.185:2087#SG
47.236.10.182:2096#SG
150.66.24.104:34237#JP
64.110.83.231:23022#JP
138.3.215.231:44784#JP
168.138.213.1:50003#JP
45.251.240.229:34237#JP
43.153.181.217:443#JP
61.220.65.189:26832#TW
203.69.248.40:27381#TW
203.69.248.40:27381#TW
45.251.240.229:34237#JP
103.232.214.11:8443#JP
103.20.199.101:33004#JP
140.238.12.52:8443#JP
37.128.252.113:31141#TW
141.11.86.86:34237#TW
211.75.243.91:16764#TW
166.0.199.138:8268#TW
146.56.37.60:20017#KR
211.224.115.109:10084#KR
61.220.65.189:26832#TW
183.98.120.11:12266#KR
222.108.18.150:19013#KR
121.180.212.30:12345#KR
146.56.41.180:34237#KR
152.70.245.66:12693#KR
144.24.83.117:443#KR
146.56.99.22:20443#KR
175.125.207.253:12534#KR
103.169.142.71:443#CF
45.159.218.146:443#CF
103.160.204.122:443#CF
45.159.218.229:443#CF
222.119.56.43:15812#KR
43.201.60.107:10002#KR
103.160.204.59:443#CF
198.62.62.4:443#CF
75.2.32.4:443#CF
104.17.142.12:443#CF
104.17.68.85:443#CF
104.17.71.31:443#CF
167.114.153.39:8443#CA
198.23.223.178:2053#CA


1 change: 1 addition & 0 deletions output_temp/.build_date.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sat Aug 31 15:05:48 UTC 2024
1 change: 1 addition & 0 deletions variables.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
generated_at: Sat Aug 31 15:05:48 UTC 2024
Loading