Last active
May 18, 2025 07:51
-
-
Save yanyongyu/bc4f8d7fe08850db819178ec1c7fa205 to your computer and use it in GitHub Desktop.
Clash Verge Custom Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const proxyGroups = [ | |
{ | |
name: "๐ง ๆจกๅผๅๆข", | |
type: "select", | |
proxies: ["๐ ่็น้ๆฉ", "DIRECT"], | |
}, | |
{ | |
name: "๐ ่็น้ๆฉ", | |
type: "select", | |
proxies: [], | |
}, | |
{ | |
name: "๐ฏ ๅ จ็็ด่ฟ", | |
type: "select", | |
proxies: ["DIRECT", "๐ง ๆจกๅผๅๆข"], | |
}, | |
{ | |
name: "๐ ๅ จ็ๆฆๆช", | |
type: "select", | |
proxies: ["REJECT", "DIRECT", "๐ง ๆจกๅผๅๆข"], | |
}, | |
{ | |
name: "๐ ๆผ็ฝไน้ฑผ", | |
type: "select", | |
proxies: ["๐ง ๆจกๅผๅๆข", "DIRECT"], | |
}, | |
]; | |
const ruleProviders = { | |
direct: { | |
type: "http", | |
behavior: "domain", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/direct.txt", | |
path: "./ruleset/direct.yaml", | |
interval: 86400, | |
}, | |
proxy: { | |
type: "http", | |
behavior: "domain", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/proxy.txt", | |
path: "./ruleset/proxy.yaml", | |
interval: 86400, | |
}, | |
reject: { | |
type: "http", | |
behavior: "domain", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/reject.txt", | |
path: "./ruleset/reject.yaml", | |
interval: 86400, | |
}, | |
icloud: { | |
type: "http", | |
behavior: "domain", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/icloud.txt", | |
path: "./ruleset/icloud.yaml", | |
interval: 86400, | |
}, | |
apple: { | |
type: "http", | |
behavior: "domain", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/apple.txt", | |
path: "./ruleset/apple.yaml", | |
interval: 86400, | |
}, | |
google: { | |
type: "http", | |
behavior: "domain", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/google.txt", | |
path: "./ruleset/google.yaml", | |
interval: 86400, | |
}, | |
private: { | |
type: "http", | |
behavior: "domain", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/private.txt", | |
path: "./ruleset/private.yaml", | |
interval: 86400, | |
}, | |
gfw: { | |
type: "http", | |
behavior: "domain", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/gfw.txt", | |
path: "./ruleset/gfw.yaml", | |
interval: 86400, | |
}, | |
"tld-not-cn": { | |
type: "http", | |
behavior: "domain", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/tld-not-cn.txt", | |
path: "./ruleset/tld-not-cn.yaml", | |
interval: 86400, | |
}, | |
telegramcidr: { | |
type: "http", | |
behavior: "ipcidr", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/telegramcidr.txt", | |
path: "./ruleset/telegramcidr.yaml", | |
interval: 86400, | |
}, | |
cncidr: { | |
type: "http", | |
behavior: "ipcidr", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/cncidr.txt", | |
path: "./ruleset/cncidr.yaml", | |
interval: 86400, | |
}, | |
lancidr: { | |
type: "http", | |
behavior: "ipcidr", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/lancidr.txt", | |
path: "./ruleset/lancidr.yaml", | |
interval: 86400, | |
}, | |
applications: { | |
type: "http", | |
behavior: "classical", | |
url: "https://cdn.jsdelivr.net/gh/Loyalsoldier/clash-rules@release/applications.txt", | |
path: "./ruleset/applications.yaml", | |
interval: 86400, | |
}, | |
}; | |
const rules = [ | |
// DIRECT | |
"DOMAIN,clash.razord.top,๐ฏ ๅ จ็็ด่ฟ", | |
"DOMAIN,yacd.haishan.me,๐ฏ ๅ จ็็ด่ฟ", | |
"DOMAIN-SUFFIX,bytedance.net,๐ฏ ๅ จ็็ด่ฟ", | |
"DOMAIN-SUFFIX,byted.org,๐ฏ ๅ จ็็ด่ฟ", | |
"DOMAIN-SUFFIX,zijieapi.com,๐ฏ ๅ จ็็ด่ฟ", | |
// PROXY | |
"DOMAIN,services.googleapis.cn,๐ง ๆจกๅผๅๆข", // Google Play Store | |
// DEFAULT | |
"RULE-SET,applications,๐ฏ ๅ จ็็ด่ฟ", | |
"RULE-SET,private,๐ฏ ๅ จ็็ด่ฟ", | |
"RULE-SET,reject,๐ ๅ จ็ๆฆๆช", | |
"RULE-SET,icloud,๐ฏ ๅ จ็็ด่ฟ", | |
"RULE-SET,apple,๐ฏ ๅ จ็็ด่ฟ", | |
"RULE-SET,google,๐ฏ ๅ จ็็ด่ฟ", | |
"RULE-SET,proxy,๐ง ๆจกๅผๅๆข", | |
"RULE-SET,direct,๐ฏ ๅ จ็็ด่ฟ", | |
"RULE-SET,lancidr,๐ฏ ๅ จ็็ด่ฟ", | |
"RULE-SET,cncidr,๐ฏ ๅ จ็็ด่ฟ", | |
"RULE-SET,telegramcidr,๐ง ๆจกๅผๅๆข", | |
"GEOIP,LAN,๐ฏ ๅ จ็็ด่ฟ", | |
"GEOIP,CN,๐ฏ ๅ จ็็ด่ฟ", | |
"MATCH,๐ ๆผ็ฝไน้ฑผ", | |
]; | |
const dns = { | |
enable: true, | |
listen: "0.0.0.0:1053", | |
ipv6: false, | |
"use-hosts": true, | |
"use-system-hosts": true, | |
enhancedMode: "fake-ip", | |
"default-nameserver": [ | |
"223.6.6.6", | |
"8.8.8.8", | |
"1.1.1.1", | |
"114.114.115.115", | |
"114.114.114.114", | |
], | |
nameserver: [ | |
"https://dns.adguard-dns.com/dns-query", | |
"https://doh.pub/dns-query", | |
"https://dns.alidns.com/dns-query", | |
], | |
fallback: [ | |
"https://dns64.dns.google/dns-query", | |
"https://adg.geili.me/dns-query", | |
"https://sunnygyl.com/dns-query", | |
"tls://8.8.4.4", | |
"tls://1.1.1.1", | |
], | |
"fallback-filter": { | |
geoip: true, | |
"geoip-code": "CN", | |
geosite: ["gfw"], | |
ipcidr: ["240.0.0.0/4"], | |
domain: ["+.google.com", "+.facebook.com", "+.youtube.com"], | |
}, | |
"fake-ip-range": "198.18.0.1/16", | |
"fake-ip-filter": [ | |
"*.lan", | |
"*.linksys.com", | |
"*.linksyssmartwifi.com", | |
"swscan.apple.com", | |
"mesu.apple.com", | |
"*.msftconnecttest.com", | |
"*.msftncsi.com", | |
"time.*.com", | |
"time.*.gov", | |
"time.*.edu.cn", | |
"time.*.apple.com", | |
"time1.*.com", | |
"time2.*.com", | |
"time3.*.com", | |
"time4.*.com", | |
"time5.*.com", | |
"time6.*.com", | |
"time7.*.com", | |
"ntp.*.com", | |
"ntp1.*.com", | |
"ntp2.*.com", | |
"ntp3.*.com", | |
"ntp4.*.com", | |
"ntp5.*.com", | |
"ntp6.*.com", | |
"ntp7.*.com", | |
"*.time.edu.cn", | |
"*.ntp.org.cn", | |
"+.pool.ntp.org", | |
"time1.cloud.tencent.com", | |
"+.srv.nintendo.net", | |
"+.stun.playstation.net", | |
"xbox.*.microsoft.com", | |
"+.xboxlive.com", | |
"localhost.ptlogin2.qq.com", | |
"+.stun.*.*", | |
"+.stun.*.*.*", | |
"+.stun.*.*.*.*", | |
"+.stun.*.*.*.*.*", | |
"WORKGROUP", | |
"controlplane.tailscale.com", | |
"log.tailscale.i", | |
], | |
}; | |
function main(config, profileName) { | |
const proxyCount = config?.proxies?.length ?? 0; | |
const proxyProviderCount = | |
typeof config?.["proxy-providers"] === "object" | |
? Object.keys(config["proxy-providers"]).length | |
: 0; | |
if (proxyCount === 0 && proxyProviderCount === 0) { | |
throw new Error("้ ็ฝฎๆไปถไธญๆชๆพๅฐไปปไฝไปฃ็"); | |
} | |
config["mixed-port"] = 7890; | |
config["mode"] = "rule"; | |
config["external-controller"] = ":9090"; | |
config["allow-lan"] = false; | |
config["dns"] = dns; | |
proxies = config["proxies"]; | |
proxyNames = proxies.map((proxy) => proxy.name); | |
config["proxy-groups"] = proxyGroups.map((group) => | |
group.name === "๐ ่็น้ๆฉ" ? { ...group, proxies: proxyNames } : group | |
); | |
config["rule-providers"] = ruleProviders; | |
config["rules"] = rules; | |
return config; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment