Go to file
ping a4e417a2ce fix: support cache 302 status code 2020-08-31 14:59:54 +08:00
.circleci Fix typo 2020-02-20 21:48:55 +08:00
contrib Added a contrib/goproxy.yml Stackfile for Docker Swarm deployment using Traefik 2019-01-14 11:32:10 +08:00
proxy fix: support cache 302 status code 2020-08-31 14:59:54 +08:00
renameio update go.mod to v2 2019-11-16 10:31:43 +08:00
robustio update go.mod 2019-12-04 09:29:53 +08:00
scripts fix (latest & list): 2018-12-26 21:14:10 +08:00
sumdb fix golint 2020-04-28 10:42:26 +08:00
test 修复CI死锁 2019-09-22 21:03:16 +08:00
.gitignore Make sure lcean binary file by make clean 2020-03-12 14:31:33 +08:00
Dockerfile update dockerfile add dep 2019-08-01 16:59:52 +08:00
LICENSE Initial commit 2018-08-31 16:27:07 +08:00
Makefile refactor handlers 2019-07-25 16:20:01 +08:00
README.md fix golint 2020-04-28 10:42:26 +08:00
docker-compose.yaml remove duplicate "goproxy" in docker-compose.yaml 2019-08-15 14:24:03 +08:00
go.mod update go.mod 2019-12-04 09:29:53 +08:00
go.sum update go.mod 2019-12-04 09:29:53 +08:00
main.go fix: support cache 302 status code 2020-08-31 14:59:54 +08:00

README.md

GOPROXY

CircleCI Go Report Card GoDoc

A global proxy for go modules. see: https://goproxy.io

Requirements

It invokes the local go command to answer requests.
The default cacheDir is GOPATH, you can set it up by yourself according to the situation.

Build

git clone https://github.com/goproxyio/goproxy.git
cd goproxy
make

Started

Proxy mode

./bin/goproxy -listen=0.0.0.0:80 -cacheDir=/tmp/test

If you run `go get -v pkg` in the proxy machine, should set a new GOPATH which is different from the old GOPATH, or mayebe deadlock.
See the file test/get_test.sh.

Router mode

Use the -proxy flag switch to "Router mode", which implements route filter to routing private module or public module .

                                         direct
                      +----------------------------------> private repo
                      |
                 match|pattern
                      |
                  +---+---+           +----------+
go get  +-------> |goproxy| +-------> |goproxy.io| +---> golang.org/x/net
                  +-------+           +----------+
                 router mode           proxy mode

In Router mode, use the -exclude flag set pattern , direct to the repo which match the module path, pattern are matched to the full path specified, not only to the host component.

./bin/goproxy -listen=0.0.0.0:80 -cacheDir=/tmp/test -proxy https://goproxy.io -exclude "*.corp.example.com,rsc.io/private"

Use docker image

docker run -d -p80:8081 goproxy/goproxy

Use the -v flag to persisting the proxy module data (change cacheDir to your own dir):

docker run -d -p80:8081 -v cacheDir:/go goproxy/goproxy

Docker Compose

docker-compose up

Appendix

  1. set export GOPROXY=http://localhost to enable your goproxy.
  2. set export GOPROXY=direct to disable it.