guzzhao 最近的时间轴更新
guzzhao

guzzhao

V2EX 第 248437 号会员,加入于 2017-08-13 21:51:18 +08:00
今日活跃度排名 1333
根据 guzzhao 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
guzzhao 最近回复了
21 天前
回复了 Ashe007 创建的主题 程序员 chocolatey 安装 Git 软件(Windows 系统)
用 scoop
scoop update *
妙界吗,我也有点心动,就是怕质量不好
分子
44 天前
回复了 Livid 创建的主题 V2EX 站点状态 20240505 - 邀请码系统
我邮箱和 google 是两个账号,有没有办法合并
分母
55 天前
回复了 b1t 创建的主题 问与答 突然好奇, Obsidian 是用什么框架开发的?
electron+codemirror
65 天前
回复了 fyxtc 创建的主题 问与答 你们梯子的‘漏网之鱼’都是怎么处理的
我用的是 clash verge 的脚本
```

const mainSelect = "🚀 节点选择"
const autoSelect = "🎃 自动选择"
const otherSelect = "🐟 漏网之鱼"
const githubProxyUrl = "https://ghproxy.net/https://raw.githubusercontent.com/"
const myProxyUrlList = [
'npmmirror.com'
]
const myDirectUrlList = [
]



function main(params) {

initDns(params)
initGroups(params)
initRules(params)
delParams(params)
// 自定义
microsoftRules(params)
myRules(params)
return params;
}

function initGroups(params) {

const proxies = params["proxies"].map(e => e.name)

const groupFilter = {
"🇭🇰 香港 自动选择": "港|HK|Hong",
"🇯🇵 日本 自动选择": "日|东京|JP|Japan",
"🇸🇬 新加坡 自动选择": "新|坡|獅|SG|Singapore"
}

let auto = Object.keys(groupFilter).map(gf => {
return {
name: gf,
type: 'url-test',
url: 'https://cp.cloudflare.com/generate_204',
tolerance: 20,
proxies: proxies.filter(p => new RegExp(groupFilter[gf]).test(p))
}
}).filter(e => e.proxies.length > 0)

const proxyGroups = [
{
name: mainSelect,
type: 'select',
proxies: [autoSelect, ...auto.map(e => e.name), ...proxies]
},
{
name: otherSelect,
type: 'select',
proxies: [mainSelect, 'DIRECT']
},
{
name: autoSelect,
type: 'url-test',
url: 'https://cp.cloudflare.com/generate_204',
tolerance: 20,
proxies: proxies
}, ...auto
]

params["proxy-groups"] = proxyGroups
}

function initRules(params) {

let baseUrl = githubProxyUrl + "Loyalsoldier/clash-rules/release/";
let ruleProvidersKeys = [
'reject',
'icloud',
'apple',
// 'google',
'proxy',
'direct',
'private',
// 'gfw', proxy 包含 gfw
'tld-not-cn',
// 'telegramcidr',
'cncidr',
'lancidr',
'applications']

let ruleProviders = {}
ruleProvidersKeys.forEach(e => {
ruleProviders[e] = {
type: "http",
behavior: "domain",
url: baseUrl + `${e}.txt`,
path: `./ruleset/${e}.yaml`,
interval: 86400
}
})

let rules = [
"RULE-SET,applications,DIRECT",
"DOMAIN,clash.razord.top,DIRECT",
"DOMAIN,yacd.haishan.me,DIRECT",
"RULE-SET,private,DIRECT",
"RULE-SET,reject,REJECT", // 广告域名列表
"RULE-SET,icloud,DIRECT",
"RULE-SET,apple,DIRECT",
// "RULE-SET,google," + mainSelect, Google 在中国大陆可直连的域名列表
"RULE-SET,direct,DIRECT",
"RULE-SET,lancidr,DIRECT",
"RULE-SET,cncidr,DIRECT",
// "RULE-SET,telegramcidr," + mainSelect,
"RULE-SET,proxy," + mainSelect,
"GEOIP,CN,DIRECT,no-resolve",
"MATCH," + otherSelect
]

params["rule-providers"] = ruleProviders
params["rules"] = rules

}

function initDns(params) {
params["dns"] = {
"enable": true,
"ipv6": false,
"listen": "0.0.0.0:1053",
"default-nameserver": [
"223.5.5.5",
"119.29.29.29",
"114.114.114.114"
],
"enhanced-mode": "fake-ip",
"fake-ip-range": "28.0.0.1/8",
"use-hosts": true,
"nameserver": [
"tls://223.5.5.5:853",
"tls://223.6.6.6:853",
"https://doh.pub/dns-query",
"https://dns.alidns.com/dns-query"
],
"fallback": [
"https://doh.dns.sb/dns-query",
"https://dns.cloudflare.com/dns-query",
"https://dns.twnic.tw/dns-query",
"tls://8.8.4.4:853"
],
"fallback-filter": {
"geoip": true,
"ipcidr": [
"240.0.0.0/4",
"0.0.0.0/32"
]
}
}
}

function delParams(params) {
delete params["cfw-conn-break-strategy"]
delete params["experimental"]
delete params["hosts"]
delete params["cfw-latency-timeout"]
delete params["cfw-latency-url"]
delete params["clash-for-android"]
delete params["udp"]


}

function microsoftRules(params) {

let baseUrl = githubProxyUrl + "blackmatrix7/ios_rule_script/master/rule/Clash/";
let microsoftProviders = {
'microsoft': {
type: "http",
behavior: "classical",
url: baseUrl + "Microsoft/Microsoft.yaml",
path: `./ruleset/microsoft.yaml`,
interval: 86400
},
"bing": {
type: "http",
behavior: "classical",
url: baseUrl + "Bing/Bing.yaml",
path: `./ruleset/bing.yaml`,
interval: 86400
},
"oneDrive": {
type: "http",
behavior: "classical",
url: baseUrl + "OneDrive/OneDrive.yaml",
path: `./ruleset/oneDrive.yaml`,
interval: 86400
},
}

let microsoftRules = [
"RULE-SET,microsoft,Microsoft",
"RULE-SET,bing,Microsoft",
"RULE-SET,oneDrive,Microsoft"
]
let microsoftGroup = {
name: 'Microsoft',
type: 'select',
proxies: [mainSelect, "DIRECT"]
}

params["rule-providers"] = { ...microsoftProviders, ...params["rule-providers"] }
params["rules"] = [...microsoftRules, ...params["rules"]]
params["proxy-groups"] = [...params["proxy-groups"], microsoftGroup]

}


function myRules(params) {
let rules = [
...myDirectUrlList.map(e => 'DOMAIN-SUFFIX,' + e + ',DIRECT'),
...myProxyUrlList.map(e => 'DOMAIN-SUFFIX,' + e + ',' + mainSelect),
]

console.log(rules)
params["rules"] = [...rules, ...params["rules"]]
}




```
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2943 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 13:05 · PVG 21:05 · LAX 06:05 · JFK 09:05
Developed with CodeLauncher
♥ Do have faith in what you're doing.