diff options
Diffstat (limited to 'xmake/modules/net/proxy.lua')
| -rw-r--r-- | xmake/modules/net/proxy.lua | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/xmake/modules/net/proxy.lua b/xmake/modules/net/proxy.lua index e216931dd..0d6b6805b 100644 --- a/xmake/modules/net/proxy.lua +++ b/xmake/modules/net/proxy.lua @@ -39,6 +39,9 @@ end -- pac.lua -- -- @code +-- function mirror(url) +-- return url:gsub("github.com", "hub.fastgit.org") +-- end -- function main(url, host) -- if host:find("bintray.com") then -- return true @@ -75,11 +78,20 @@ function _host_pattern(pattern) return pattern end +-- get proxy mirror url +function mirror(url) + local proxy_pac = _proxy_pac() + if proxy_pac and proxy_pac.mirror then + return proxy_pac.mirror(url) + end + return url +end + -- get proxy configuration from the given url, [protocol://]host[:port] -- -- @see https://github.com/xmake-io/xmake/issues/854 -- -function get(url) +function config(url) -- enable proxy for the given url and configuration pattern if url then |
