Skip to content

Commit

Permalink
bug fixes, singbox routing, WoW best ping.
Browse files Browse the repository at this point in the history
  • Loading branch information
bia-pain-bache committed Sep 6, 2024
1 parent 06a110a commit b004179
Showing 1 changed file with 34 additions and 20 deletions.
54 changes: 34 additions & 20 deletions _worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1154,18 +1154,18 @@ function generateRemark(index, port, protocol, fragType) {
switch (index) {
case 0:
case 1:
remark = `💦 BPB ${protocol}${type} - Domain ${index + 1} : ${port}`;
remark = `💦 ${protocol}${type} - Domain ${index + 1} : ${port}`;
break;
case 2:
case 3:
remark = `💦 BPB ${protocol}${type} - IPv4 ${index - 1} : ${port}`;
remark = `💦 ${protocol}${type} - IPv4 ${index - 1} : ${port}`;
break;
case 4:
case 5:
remark = `💦 BPB ${protocol}${type} - IPv6 ${index - 3} : ${port}`;
remark = `💦 ${protocol}${type} - IPv6 ${index - 3} : ${port}`;
break;
default:
remark = `💦 BPB ${protocol}${type} - Clean IP ${index - 5} : ${port}`;
remark = `💦 ${protocol}${type} - Clean IP ${index - 5} : ${port}`;
break;
}

Expand Down Expand Up @@ -3754,7 +3754,7 @@ async function getClashConfig (env, hostName, isWarp) {
blockPorn && rules.push('GEOSITE,CATEGORY-PORN,REJECT');
bypassLAN && rules.push('GEOIP,LAN,DIRECT');

return {
let config = {
"mixed-port": 7890,
"allow-lan": true,
"mode": "rule",
Expand Down Expand Up @@ -3800,7 +3800,7 @@ async function getClashConfig (env, hostName, isWarp) {
"type": "select",
"proxies": isWarp
? ['💦 Warp Best Ping 🚀', '💦 WoW Best Ping 🚀', ...warpOutboundsRemarks, ...wowOutboundRemarks ]
: ['💦 Best-Ping 💥', ...outboundsRemarks ]
: ['💦 Best Ping 💥', ...outboundsRemarks ]
},
{
"name": isWarp ? `💦 Warp Best Ping 🚀`: `💦 Best Ping 💥`,
Expand All @@ -3809,20 +3809,21 @@ async function getClashConfig (env, hostName, isWarp) {
"interval": 30,
"tolerance": 50,
"proxies": isWarp ? warpOutboundsRemarks : outboundsRemarks
},
{
...(isWarp && {
"name": "💦 WoW Best Ping 🚀",
"type": "url-test",
"url": "https://www.gstatic.com/generate_204",
"interval": 30,
"tolerance": 50,
"proxies": wowOutboundRemarks
})
}
],
"rules": [...rules, 'MATCH,✅ Selector']
};

isWarp && config["proxy-groups"].push({
"name": "💦 WoW Best Ping 🚀",
"type": "url-test",
"url": "https://www.gstatic.com/generate_204",
"interval": 30,
"tolerance": 50,
"proxies": wowOutboundRemarks
});

return config;
}

function buildSingboxVLESSOutbound (remark, address, port, uuid, host, path) {
Expand Down Expand Up @@ -3997,11 +3998,18 @@ function buildSingboxRoutingRules (blockAds, bypassIran, bypassChina, blockPorn,
});
}

bypassChina && rules.push({
geosite: "cn",
geoip: "cn",
outbound: "direct"
});

bypassLAN && rules.push({
ip_is_private: true,
outbound: "direct"
});


let blockRuleSet = {
rule_set: [
"geosite-malware",
Expand Down Expand Up @@ -4143,8 +4151,8 @@ async function getSingboxConfig (env, hostName, client, warpType) {
const {rules, rule_set} = buildSingboxRoutingRules (blockAds, bypassIran, bypassChina, blockPorn, blockUDP443, bypassLAN);
config.route.rules = rules;
config.route.rule_set = rule_set;
blockAds && config.dns.rules[1].rule_set.push("geosite-category-ads-all");
blockPorn && config.dns.rules[1].rule_set.push("geosite-nsfw");
blockAds && config.dns.rules[2].rule_set.push("geosite-category-ads-all");
blockPorn && config.dns.rules[2].rule_set.push("geosite-nsfw");

return config;
}
Expand Down Expand Up @@ -5166,6 +5174,12 @@ const singboxConfigTemp = {
],
server: "dns-direct"
},
{
outbound: [
"any"
],
server: "dns-direct"
},
{
disable_cache: true,
rule_set: [
Expand Down Expand Up @@ -5213,11 +5227,11 @@ const singboxConfigTemp = {
{
type: "selector",
tag: "proxy",
outbounds: ["💦 Best-Ping 💥"]
outbounds: ["💦 Best Ping 💥"]
},
{
type: "urltest",
tag: "💦 Best-Ping 💥",
tag: "💦 Best Ping 💥",
outbounds: [],
url: "https://www.gstatic.com/generate_204",
interval: "30s",
Expand Down

0 comments on commit b004179

Please sign in to comment.