mirror of https://github.com/goproxyio/goproxy
b0c281ea9c
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.9.0 to 1.11.1. - [Release notes](https://github.com/prometheus/client_golang/releases) - [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/client_golang/compare/v1.9.0...v1.11.1) --- updated-dependencies: - dependency-name: github.com/prometheus/client_golang dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.circleci | ||
.github | ||
contrib | ||
proxy | ||
renameio | ||
robustio | ||
scripts | ||
sumdb | ||
test | ||
.gitignore | ||
Dockerfile | ||
LICENSE | ||
Makefile | ||
README.md | ||
docker-compose.yaml | ||
go.mod | ||
go.sum | ||
main.go |
README.md
GOPROXY
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
./bin/goproxy -listen=0.0.0.0:80 -proxy https://goproxy.io
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
- set
export GOPROXY=http://localhost
to enable your goproxy. - set
export GOPROXY=direct
to disable it.