feat(rulesets): add Twitch preset and resilient CDN fallback
This commit is contained in:
@@ -46,6 +46,13 @@ assert(url.github_to_jsdelivr("https://raw.githubusercontent.com/owner/repo/main
|
||||
let candidates = url.download_candidates("https://github.com/owner/repo/blob/main/hosts");
|
||||
assert(candidates[0] == "https://raw.githubusercontent.com/owner/repo/main/hosts", "download_candidates first entry normalized");
|
||||
|
||||
let twitch_candidates = url.download_candidates("https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geosite/twitch.srs");
|
||||
assert(twitch_candidates[0] == "https://raw.githubusercontent.com/MetaCubeX/meta-rules-dat/sing/geo/geosite/twitch.srs", "twitch candidate 0 is raw github");
|
||||
assert(twitch_candidates[1] == "https://cdn.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/twitch.srs", "twitch candidate 1 is jsdelivr cdn");
|
||||
for (let c in twitch_candidates) {
|
||||
assert(index(c, "forkop") < 0, "no forkop mirrors allowed");
|
||||
}
|
||||
|
||||
// authority, host, port, userinfo with @ in query parameters
|
||||
let complex = "vless://user-uuid@example.com:8443?authority=name@channel&mode=gun#my-fragment";
|
||||
assert(url.authority(complex) == "example.com:8443", "authority strips userinfo and query with @");
|
||||
|
||||
Reference in New Issue
Block a user