Skip to content

Update global_script.js #19

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions Mihomo/global_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
*/
const enable = true

// ---- 直连绕过的IP配置 ----
const PASS_IP = []

/**
* 分流规则配置,会自动生成对应的策略组
* 设置的时候可遵循“最小,可用”原则,把自己不需要的规则全禁用掉,提高效率
Expand Down Expand Up @@ -41,6 +44,7 @@ const ruleOptions = {
japan: true, // 日本网站策略组
tracker: true, // 网络分析和跟踪服务
ads: true, // 常见的网络广告
passip: true, // 直连绕过特定IP
}

/**
Expand Down Expand Up @@ -705,6 +709,13 @@ function main(config) {
}
)

// 添加直连绕过IP配置
if (ruleOptions.passip) {
PASS_IP.forEach(ip => {
rules.push(`IP-CIDR,${ip}/32,DIRECT,no-resolve`);
});
}

config['proxy-groups'] = config['proxy-groups'].concat(regionProxyGroups)

// 覆盖原配置中的规则
Expand Down