summaryrefslogtreecommitdiff
path: root/xmake/scripts/pac/github_mirror.lua
blob: 026a9a50c31abb5ed82d8163c62d142dc8e212af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import("net.fasturl")

function mirror(url)
    local configs = {}
    local proxyurls = {"github.com.cnpmjs.org", "hub.fastgit.org"}
    fasturl.add(proxyurls)
    proxyurls = fasturl.sort(proxyurls)
    if #proxyurls > 0 then
        return url:replace("/github.com/", "/" .. proxyurls[1] .. "/", {plain = true})
    end
end