A minimalist Go module proxy handler.
Goproxy has fully implemented the
GOPROXY protocol. Our goal 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.
Yeah, there is no Makefile
, no configuration files, no crazy file
organization, no lengthy documentation, no annoying stuff, just a
goproxy.Goproxy
that
implements the http.Handler
.
goproxy.Goproxy
and goproxy.DirCacher
goproxy.Cacher
GOPROXY
support
https://proxy.golang.org,direct
(just like what Go is doing right now)GONOPROXY
supportGOSUMDB
support
sum.golang.org
(just like what Go is doing right now)GONOSUMDB
supportGOPRIVATE
supportGOPROXY
Disable-Module-Fetch
headerOpen your terminal and execute
$ # Use it programmatically (RECOMMENDED).
$ go get github.com/goproxy/goproxy
$ # Or use our minimalist CLI implementation.
$ go install github.com/goproxy/goproxy/cmd/goproxy@latest
$ # Or use our minimalist Docker image.
$ docker pull ghcr.io/goproxy/goproxy
done.
The only requirement is the Go, at least v1.13.
Create a file named goproxy.go
package main
import (
"net/http"
"github.com/goproxy/goproxy"
)
func main() {
http.ListenAndServe("localhost:8080", &goproxy.Goproxy{})
}
and run it
$ go run goproxy.go
then try it by setting GOPROXY
to http://localhost:8080
by following the
instructions below. In addition, we also recommend that you set GO111MODULE
to
on
instead of auto
when you are working with Go modules.
Open your terminal and execute
$ go env -w GOPROXY=http://localhost:8080,direct
done.
Open your terminal and execute
$ export GOPROXY=http://localhost:8080
or
$ echo "export GOPROXY=http://localhost:8080" >> ~/.profile && source ~/.profile
done.
Open your PowerShell and execute
C:\> $env:GOPROXY = "http://localhost:8080"
or
1. Open the Start Search, type in "env"
2. Choose the "Edit the system environment variables"
3. Click the "Environment Variables…" button
4. Under the "User variables for <YOUR_USERNAME>" section (the upper half)
5. Click the "New..." button
6. Choose the "Variable name" input bar, type in "GOPROXY"
7. Choose the "Variable value" input bar, type in "http://localhost:8080"
8. Click the "OK" button
done.
If you want to discuss Goproxy, or ask questions about it, simply post questions or ideas here.
If you want to help build Goproxy, simply follow this to send pull requests here.
This project is licensed under the MIT License.
License can be found here.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。