From c4474df83acde02740033089a74ce376b7752f29 Mon Sep 17 00:00:00 2001 From: bia-pain-bache Date: Thu, 17 Oct 2024 14:58:15 +0330 Subject: [PATCH] Bug fix. --- _worker.js | 16 +++++++--------- src/worker.js | 16 +++++++--------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/_worker.js b/_worker.js index cbf07e01b..2eac242a1 100644 --- a/_worker.js +++ b/_worker.js @@ -7090,7 +7090,7 @@ function buildXrayRoutingRules(proxySettings, outboundAddrs, isChain, isBalancer blockPorn, blockUDP443 } = proxySettings; - const isBypass = bypassIran || bypassChina || bypassRussia; + const isBypass = bypassIran || bypassChina || bypassRussia || bypassLAN; const outboundDomains = outboundAddrs.filter((address) => isDomain(address)); const isOutboundRule = outboundDomains.length > 0; let rules = [ @@ -7118,7 +7118,7 @@ function buildXrayRoutingRules(proxySettings, outboundAddrs, isChain, isBalancer outboundTag: "direct", type: "field" }); - if (isBypass) { + if (isBypass && !isWorkerLess) { let ipRule = { ip: [], outboundTag: "direct", @@ -7129,13 +7129,11 @@ function buildXrayRoutingRules(proxySettings, outboundAddrs, isChain, isBalancer outboundTag: "direct", type: "field" }; - if (!isWorkerLess) { - bypassLAN && domainRule.domain.push("geosite:private") && ipRule.ip.push("geoip:private"); - bypassIran && domainRule.domain.push("geosite:category-ir") && ipRule.ip.push("geoip:ir"); - bypassChina && domainRule.domain.push("geosite:cn") && ipRule.ip.push("geoip:cn"); - bypassRussia && domainRule.domain.push("geosite:category-ru") && ipRule.ip.push("geoip:ru"); - rules.push(domainRule, ipRule); - } + bypassLAN && domainRule.domain.push("geosite:private") && ipRule.ip.push("geoip:private"); + bypassIran && domainRule.domain.push("geosite:category-ir") && ipRule.ip.push("geoip:ir"); + bypassChina && domainRule.domain.push("geosite:cn") && ipRule.ip.push("geoip:cn"); + bypassRussia && domainRule.domain.push("geosite:category-ru") && ipRule.ip.push("geoip:ru"); + rules.push(domainRule, ipRule); } blockUDP443 && rules.push({ network: "udp", diff --git a/src/worker.js b/src/worker.js index 60ef6c083..f18582de6 100644 --- a/src/worker.js +++ b/src/worker.js @@ -3375,7 +3375,7 @@ function buildXrayRoutingRules (proxySettings, outboundAddrs, isChain, isBalance blockUDP443 } = proxySettings; - const isBypass = bypassIran || bypassChina || bypassRussia; + const isBypass = bypassIran || bypassChina || bypassRussia || bypassLAN; const outboundDomains = outboundAddrs.filter(address => isDomain(address)); const isOutboundRule = outboundDomains.length > 0; let rules = [ @@ -3404,7 +3404,7 @@ function buildXrayRoutingRules (proxySettings, outboundAddrs, isChain, isBalance type: "field" }); - if (isBypass) { + if (isBypass && !isWorkerLess) { let ipRule = { ip: [], outboundTag: "direct", @@ -3417,13 +3417,11 @@ function buildXrayRoutingRules (proxySettings, outboundAddrs, isChain, isBalance type: "field", }; - if (!isWorkerLess) { - bypassLAN && domainRule.domain.push("geosite:private") && ipRule.ip.push("geoip:private"); - bypassIran && domainRule.domain.push("geosite:category-ir") && ipRule.ip.push("geoip:ir"); - bypassChina && domainRule.domain.push("geosite:cn") && ipRule.ip.push("geoip:cn"); - bypassRussia && domainRule.domain.push("geosite:category-ru") && ipRule.ip.push("geoip:ru"); - rules.push(domainRule, ipRule); - } + bypassLAN && domainRule.domain.push("geosite:private") && ipRule.ip.push("geoip:private"); + bypassIran && domainRule.domain.push("geosite:category-ir") && ipRule.ip.push("geoip:ir"); + bypassChina && domainRule.domain.push("geosite:cn") && ipRule.ip.push("geoip:cn"); + bypassRussia && domainRule.domain.push("geosite:category-ru") && ipRule.ip.push("geoip:ru"); + rules.push(domainRule, ipRule); } blockUDP443 && rules.push({