| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 
 | const vlessConfig = `
 # 白名单模式,国内直连命中规则走直连,其他全部走代理
 # 规则集来自https://github.com/Loyalsoldier/clash-rules
 # 规则文件使用https://ghp.ci。加速访问
 allow-lan: true
 mode: Rule
 log-level: info
 proxies:
 - {name: 美国24, server: 172.245.156.24, port: 27818, reality-opts: {public-key: g1f1wLjim5gOVGnI5LGUV0dL4iFXPoiepOPZfSxJe14}, client-fingerprint: chrome, type: vless, uuid: 391fd05c-00c4-4931-b5cd-d21bf9ff1be9, tls: true, tfo: false, flow: xtls-rprx-vision, skip-cert-verify: false, servername: www.faketeams.com, network: tcp}
 proxy-groups:
 - name: 外网
 type: select
 proxies:
 - 美国24
 - DIRECT
 - name: 直连
 type: select
 proxies:
 - DIRECT
 - 美国24
 - name: 广告
 type: select
 proxies:
 - REJECT
 - DIRECT
 rule-providers:
 reject:
 type: http
 behavior: domain
 url: "https://ghp.ci/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/reject.txt"
 path: ./ruleset/reject.yaml
 interval: 86400
 
 direct:
 type: http
 behavior: domain
 url: "https://ghp.ci/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/direct.txt"
 path: ./ruleset/direct.yaml
 interval: 86400
 
 icloud:
 type: http
 behavior: domain
 url: "https://ghp.ci/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/icloud.txt"
 path: ./ruleset/icloud.yaml
 interval: 86400
 
 apple:
 type: http
 behavior: domain
 url: "https://ghp.ci/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/apple.txt"
 path: ./ruleset/apple.yaml
 interval: 86400
 
 private:
 type: http
 behavior: domain
 url: "https://ghp.ci/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/private.txt"
 path: ./ruleset/private.yaml
 interval: 86400
 
 applications:
 type: http
 behavior: classical
 url: "https://ghp.ci/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/applications.txt"
 path: ./ruleset/applications.yaml
 interval: 86400
 
 lancidr:
 type: http
 behavior: ipcidr
 url: "https://ghp.ci/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/lancidr.txt"
 path: ./ruleset/lancidr.yaml
 interval: 86400
 
 cncidr:
 type: http
 behavior: ipcidr
 url: "https://ghp.ci/https://raw.githubusercontent.com/Loyalsoldier/clash-rules/release/cncidr.txt"
 path: ./ruleset/cncidr.yaml
 interval: 86400
 rules:
 - RULE-SET,reject,广告
 - RULE-SET,direct,直连
 - RULE-SET,icloud,直连
 - RULE-SET,apple,直连
 - RULE-SET,private,直连
 - RULE-SET,applications,直连
 - RULE-SET,lancidr,直连
 - RULE-SET,cncidr,直连
 - GEOIP,LAN,直连
 - GEOIP,CN,直连
 - MATCH,外网
 `;
 
 
 
 
 export default {
 
 async fetch(request, env, ctx) {
 const url = new URL(request.url);
 const UA = request.headers.get('User-Agent') || 'null';
 const userAgent = UA.toLowerCase();
 switch (url.pathname.toLowerCase()) {
 case '/':
 return new Response('<!DOCTYPE html><html><body><h1>别尝试访问这里,这里没有你想要的。</h1></body></html>', {
 headers: { "content-type": "text/html;charset=UTF-8" }
 });
 case `/${env.UUID}`:
 // if (userAgent && userAgent.includes('mozilla')){
 //   return new Response(`请将地址填入客户端中使用,不会用来问我。\nhttps://diaoqi.767766.xyz/${env.UUID}`);
 // }
 const today = new Date();
 const end = new Date(today.getFullYear(), 11, 31)
 const expire = Math.floor(end.getTime() / 1000) // 今年最后一天时间戳(到秒)
 let FileName = 'Diaoqi Cloud';
 
 const haveDays = (end.getTime() - today.getTime()) / (1000 * 60 * 60 * 24) // 还剩多少天
 const UD = Math.floor((365 - haveDays) * 1073741824 / 2); // 一天算1G
 let total = 400 * 1073741824; // GB
 
 return new Response(`${vlessConfig}`, {
 status: 200,
 headers: {
 "Content-Disposition": `attachment; filename=${FileName}`,
 "Content-Type": "text/plain;charset=utf-8",
 "Profile-Update-Interval": "6",
 "Content-Encoding": "gzip",
 "Subscription-Userinfo": `upload=${UD}; download=${UD}; total=${total}; expire=${expire}`,
 }
 });
 default:
 return new Response('Not found', { status: 404 });
 }
 },
 };
 
 
 |