Go to file
kun 5b72060f37 auto enable go module 2019-11-07 09:29:45 +08:00
.circleci update CI golang to 1.13 2019-09-20 16:24:37 +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 issue with excluded @latest 2019-10-11 17:13:55 +08:00
renameio renameio.WriteFile writes files atomically by renaming temporary files 2019-09-20 16:24:37 +08:00
robustio renameio.WriteFile writes files atomically by renaming temporary files 2019-09-20 16:24:37 +08:00
scripts fix (latest & list): 2018-12-26 21:14:10 +08:00
test 修复CI死锁 2019-09-22 21:03:16 +08:00
.gitignore refactor handlers 2019-07-25 16:20:01 +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 Update README.md 2019-10-16 15:24:39 +08:00
docker-compose.yaml remove duplicate "goproxy" in docker-compose.yaml 2019-08-15 14:24:03 +08:00
go.mod refactor handlers 2019-07-25 16:20:01 +08:00
go.sum refactor handlers 2019-07-25 16:20:01 +08:00
main.go auto enable go module 2019-11-07 09:29:45 +08:00

README.md

GOPROXY CircleCI

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 not 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.