自建免费 go modules 代理

2019-04-30 17:38:20 +08:00
 whitehack

github 地址: https://github.com/whtiehack/goproxy


goproxy 自建 go modules 代理,部署到 heroku

  1. 点击下面这个按钮(或者先 fork 再点,这样可以自己修改部署脚本)

goproxyheroku 自建 go modules 代理。

App name 是一个唯一的 app 名字

Choose a region 有美国和欧洲可以选。个人认为美国的速度还不错。会在 region 里随机分配一个节点给你,有的节点很快,有的比较慢。不过还是会比 goproxy.io 之类的快。

点 Create app ,等一会就部署完成了。

  1. 现在你就可以使用你自建的 go modules 代理了。

linux: export GOPROXY=https://youappname.herokuapp.com

windows: $env:GOPROXY = "https://youappname.herokuapp.com"

  1. Now, when you build and run your applications, go will fetch dependencies via https://youappname.herokuapp.com.

Note: This proxy can't fetch your private repos of course.

youappname 是你 Crate New App 时的 App name

  1. 直接打开你申请的链接应该是显示空白。

可以用这个链接测试一下: https://youappname.herokuapp.com/github.com/nsqio/nsq/@v/list

  1. heroku 部署的 app,在一段时间内没有流量会被冻结。然后有人访问的时候就才会再次启动。(所以第一次打开会比较慢,启动好了就快了)

  2. 提供一个懒人用测试地址,多人用不能保证速度,而且每个月是有限额的(一个人单独用完全足够)。所以还是建议自己 fork 自己建立一个 app。https://goproxyus.herokuapp.com

额外的功能

  1. https://goproxyus.herokuapp.com/github.com/whtiehack/goproxy/@latest

  2. https://goproxyus.herokuapp.com/github.com/whtiehack/goproxy/@v/v0.0.0-20190429094219-4f70e1c14471.zip

  3. latest 有个问题,不会再次去拿最新代码。

或者你知道明确版本的放可以构造 url 直接下载 : https://goproxyus.herokuapp.com/github.com/node-pinus/pinus/@v/v1.3.10.zip

3134 次点击
所在节点    Go 编程语言
2 条回复
nfroot
2019-04-30 18:45:14 +08:00
今天在 windows 试着编译 caddy(golang),感觉我不配,哈哈哈
whitehack
2019-04-30 18:56:08 +08:00
意思是刚接触 go ?我也刚接触。。都找小项目研究来着。。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/560189

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX