Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/goproxy/goproxy
A minimalist Go module proxy handler.
https://github.com/goproxy/goproxy
go goproxy handler minimalist module proxy
Last synced: 23 days ago
JSON representation
A minimalist Go module proxy handler.
- Host: GitHub
- URL: https://github.com/goproxy/goproxy
- Owner: goproxy
- License: mit
- Created: 2019-06-03T06:21:52.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-25T16:12:11.000Z (3 months ago)
- Last Synced: 2024-10-01T21:43:37.043Z (about 1 month ago)
- Topics: go, goproxy, handler, minimalist, module, proxy
- Language: Go
- Homepage: https://pkg.go.dev/github.com/goproxy/goproxy
- Size: 518 KB
- Stars: 1,295
- Watchers: 12
- Forks: 123
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Goproxy
[![Test](https://github.com/goproxy/goproxy/actions/workflows/test.yaml/badge.svg)](https://github.com/goproxy/goproxy/actions/workflows/test.yaml)
[![codecov](https://codecov.io/gh/goproxy/goproxy/branch/master/graph/badge.svg)](https://codecov.io/gh/goproxy/goproxy)
[![Go Report Card](https://goreportcard.com/badge/github.com/goproxy/goproxy)](https://goreportcard.com/report/github.com/goproxy/goproxy)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/goproxy/goproxy)](https://pkg.go.dev/github.com/goproxy/goproxy)A minimalist Go module proxy handler.
Goproxy has fully implemented the [GOPROXY protocol](https://go.dev/ref/mod#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
- Three structs: [`goproxy.Goproxy`](https://pkg.go.dev/github.com/goproxy/goproxy#Goproxy),
[`goproxy.GoFetcher`](https://pkg.go.dev/github.com/goproxy/goproxy#GoFetcher), and
[`goproxy.DirCacher`](https://pkg.go.dev/github.com/goproxy/goproxy#DirCacher)
- Two interfaces: [`goproxy.Fetcher`](https://pkg.go.dev/github.com/goproxy/goproxy#Fetcher) and
[`goproxy.Cacher`](https://pkg.go.dev/github.com/goproxy/goproxy#Cacher)
- Built-in support for `GOPROXY`, `GONOPROXY`, `GOSUMDB`, `GONOSUMDB`, and `GOPRIVATE`
- Supports serving under other Go module proxies by setting `GOPROXY`
- Supports [proxying checksum databases](https://go.dev/design/25530-sumdb#proxying-a-checksum-database)
- Supports `Disable-Module-Fetch` header## Installation
- To use this project programmatically, `go get` it:
```bash
go get github.com/goproxy/goproxy
```- To use this project from the command line, download the pre-built binaries from
[here](https://github.com/goproxy/goproxy/releases) or build it from source:```bash
go install github.com/goproxy/goproxy/cmd/goproxy@latest
```- To use this project with Docker, pull the pre-built images from
[here](https://github.com/goproxy/goproxy/pkgs/container/goproxy):```bash
docker pull ghcr.io/goproxy/goproxy
```## Quick Start
Write code
Create a file named `goproxy.go`:
```go
package mainimport (
"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](https://pkg.go.dev/github.com/goproxy/goproxy).
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](https://github.com/goproxy/goproxy/discussions).## Contributing
If you would like to contribute to this project, please submit issues [here](https://github.com/goproxy/goproxy/issues)
or pull requests [here](https://github.com/goproxy/goproxy/pulls).## License
This project is licensed under the [MIT License](LICENSE).