A global proxy for go modules. see: https://goproxy.io
go generate
go build
./goproxy -listen=0.0.0.0:80 -cache_dir=/data
You can also set proxy for goproxy by setting HTTP_PROXY
and HTTPS_PROXY
HTTP_PROXY=$(proxy_server) HTTPS_PROXY=$(proxy_server) ./goproxy -listen=0.0.0.0:80 -cache_dir=/data
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 cache_dir:/go goproxy/goproxy
docker-compose up
- set
export GOPROXY=http://localhost
to enable your goproxy. - set
export GOPROXY=
to disable it.