Goproxy A minimalist Go module proxy handler. Goproxy has fully implemented the GOPROXY protocol. The goal of this project is to find the most dead simple way to provide a…
Goproxy




A minimalist Go module proxy handler.
Goproxy has fully implemented the GOPROXY protocol. The goal of this project
is to find the most dead simple way to provide a minimalist handler that can act as a full-featured Go module proxy for
those who want to build their own proxies.
Features
- Extremely easy to use
goproxy.Goproxy,
goproxy.GoFetcher, and
goproxy.DirCacher
- Two interfaces: goproxy.Fetcher and
goproxy.Cacher
- Ready-to-use CLI and
Docker image
- Built-in implementation of
GOPROXY,GONOPROXY,GOSUMDB,GONOSUMDB, andGOPRIVATE - Upstream proxy support
- Checksum database proxying support
Disable-Module-Fetchheader support
Installation
- To use this project programmatically,
go getit:
bash
go get github.com/goproxy/goproxy
- To use this project from the command line, download the pre-built binaries from
bash
go install github.com/goproxy/goproxy/cmd/goproxy@latest
- To use this project with Docker, pull the pre-built images from
bash
docker pull ghcr.io/goproxy/goproxy
Quickstart
Write code
Create a file named goproxy.go:
go
package main
import (
"net/http"
"github.com/goproxy/goproxy"
)
func main() {
http.ListenAndServe("localhost:8080", &goproxy.Goproxy{})
}
Then run it with a GOMODCACHE that differs from go env GOMODCACHE:
bash
GOMODCACHE=/tmp/goproxy-gomodcache go run goproxy.go
Finally, set GOPROXY to try it out:
bash
go env -w GOPROXY=http://localhost:8080,direct
For more details, refer to the documentation.
Run from command line
Refer to the [Installation](#installation) section to download or build the binary.
Then run it with a GOMODCACHE that differs from go env GOMODCACHE:
bash
GOMODCACHE=/tmp/goproxy-gomodcache goproxy server --address localhost:8080
Finally, set GOPROXY to try it out:
bash
go env -w GOPROXY=http://localhost:8080,direct
For more details, check its usage:
bash
goproxy --help
Run with Docker
Refer to the [Installation](#installation) section to pull the image.
Then run it:
bash
docker run -p 8080:8080 ghcr.io/goproxy/goproxy server --address :8080
Finally, set GOPROXY to try it out:
bash
go env -w GOPROXY=http://localhost:8080,direct
For more details, check its usage:
bash
docker run ghcr.io/goproxy/goproxy --help
Community
If you have any questions or ideas about this project, feel free to discuss them
here.
Contributing
If you would like to contribute to this project, please submit issues here
or pull requests here.
When submitting a pull request, please make sure its commit messages adhere to
Conventional Commits 1.0.0.
License
This project is licensed under the [MIT License](LICENSE).
Members
-
goproxy ★ PINNED
A minimalist Go module proxy handler.
Go ★ 1.5k 2mo agoExplain → -
goproxy.cn ★ PINNED
The most trusted Go module proxy in China.
HTML ★ 7.1k 11mo agoExplain →
No repos match these filters.