{"id":13416842,"url":"https://github.com/goproxyio/goproxy","last_synced_at":"2025-05-14T05:10:37.838Z","repository":{"id":37431244,"uuid":"146863879","full_name":"goproxyio/goproxy","owner":"goproxyio","description":"A global proxy for Go modules.","archived":false,"fork":false,"pushed_at":"2024-02-04T03:10:43.000Z","size":143,"stargazers_count":5840,"open_issues_count":14,"forks_count":366,"subscribers_count":67,"default_branch":"master","last_synced_at":"2025-04-11T00:02:58.410Z","etag":null,"topics":["go","golang","goproxy","module","proxy"],"latest_commit_sha":null,"homepage":"https://goproxy.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goproxyio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["oiooj"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-08-31T08:27:07.000Z","updated_at":"2025-04-09T03:57:11.000Z","dependencies_parsed_at":"2023-01-23T02:30:39.676Z","dependency_job_id":"4ef4f999-ddce-4be6-997d-9a0f6a7295cc","html_url":"https://github.com/goproxyio/goproxy","commit_stats":{"total_commits":109,"total_committers":30,"mean_commits":"3.6333333333333333","dds":0.5137614678899083,"last_synced_commit":"303c77b2e6011450be54fd974fda20c50b03140d"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goproxyio%2Fgoproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goproxyio%2Fgoproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goproxyio%2Fgoproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goproxyio%2Fgoproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goproxyio","download_url":"https://codeload.github.com/goproxyio/goproxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076849,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","goproxy","module","proxy"],"created_at":"2024-07-30T22:00:23.329Z","updated_at":"2025-05-14T05:10:37.797Z","avatar_url":"https://github.com/goproxyio.png","language":"Go","readme":"# GOPROXY\n\n[![CircleCI](https://circleci.com/gh/goproxyio/goproxy.svg?style=svg)](https://circleci.com/gh/goproxyio/goproxy)\n[![Go Report Card](https://goreportcard.com/badge/github.com/goproxyio/goproxy)](https://goreportcard.com/report/github.com/goproxyio/goproxy)\n[![GoDoc](https://godoc.org/github.com/goproxyio/goproxy?status.svg)](https://godoc.org/github.com/goproxyio/goproxy)\n\nA global proxy for go modules. see: [https://goproxy.io](https://goproxy.io)\n\n## Requirements\n\nThis service invokes the local `go` command to answer requests.\n\nThe default `cacheDir` is `GOPATH`, you can set it up by yourself according to the situation.\n\n## Build\n\n```shell\ngit clone https://github.com/goproxyio/goproxy.git\ncd goproxy\nmake\n```\n\n## Started\n\n### Proxy mode    \n\n```shell\n./bin/goproxy -listen=0.0.0.0:80 -cacheDir=/tmp/test\n```\n\nIf you run `go get -v pkg` in the proxy machine, you should set a new `GOPATH` which is different from the original `GOPATH`, or you may encounter a deadlock.\n\nSee [`test/get_test.sh`](./test/get_test.sh).\n\n### Router mode    \n\n```shell\n./bin/goproxy -listen=0.0.0.0:80 -proxy https://goproxy.io\n```\n\nUse the `-proxy` flag combined with the `-exclude` flag to enable `Router mode`, which implements route filter to routing private modules or public modules.\n\n```\n                                         direct\n                      +----------------------------------\u003e private repo\n                      |\n                 match|pattern\n                      |\n                  +---+---+           +----------+\ngo get  +-------\u003e |goproxy| +-------\u003e |goproxy.io| +---\u003e golang.org/x/net\n                  +-------+           +----------+\n                 router mode           proxy mode\n```\n\nIn `Router mode`, use the `-exclude` flag to set a glob pattern. The glob will specify what packages should not try to resolve with the value of `-proxy`. Modules which match the `-exclude` pattern will resolve direct to the repo which \nmatches the module path.\n\nNOTE: Patterns are matched to the full path specified, not only to the host component.\n\n```shell\n./bin/goproxy -listen=0.0.0.0:80 -cacheDir=/tmp/test -proxy https://goproxy.io -exclude \"*.corp.example.com,rsc.io/private\"\n```\n\n### Private module authentication\n\nSome private modules are gated behind `git` authentication. To resolve this, you can force git to rewrite the URL with a personal access token present for auth\n\n```shell\ngit config --global url.\"https://${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/\".insteadOf https://github.com/\n```\n\nThis can be done for other git providers as well, following the same pattern\n\n## Use docker image\n\n```shell\ndocker run -d -p80:8081 goproxy/goproxy\n```\n\nUse the -v flag to persisting the proxy module data (change ___cacheDir___ to your own dir):\n\n```\ndocker run -d -p80:8081 -v cacheDir:/go goproxy/goproxy\n```\n\n## Docker Compose\n\n```shell\ndocker-compose up\n```\n\n## Kubernetes\n\nDeployment:\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: goproxy\n  name: goproxy\nspec:\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: goproxy\n    spec:\n      containers:\n      - args:\n        - -proxy\n        - https://goproxy.io\n        - -listen\n        - 0.0.0.0:8081\n        - -cacheDir\n        - /tmp/test\n        - -exclude\n        - github.com/my-org/*\n        image: goproxy/goproxy\n        name: goproxy\n        ports:\n        - containerPort: 8081\n        volumeMounts:\n        - mountPath: /tmp/test\n          name: goproxy\n      volumes:\n      - emptyDir:\n          medium: Memory\n          sizeLimit: 500Mi\n        name: goproxy\n```\n\nDeployment (with gitconfig secret):\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  labels:\n    app: goproxy\n  name: goproxy\nspec:\n  replicas: 1\n  template:\n    metadata:\n      labels:\n        app: goproxy\n    spec:\n      containers:\n      - args:\n        - -proxy\n        - https://goproxy.io\n        - -listen\n        - 0.0.0.0:8081\n        - -cacheDir\n        - /tmp/test\n        - -exclude\n        - github.com/my-org/*\n        image: goproxy/goproxy\n        name: goproxy\n        ports:\n        - containerPort: 8081\n        volumeMounts:\n        - mountPath: /tmp/test\n          name: goproxy\n        - mountPath: /root\n          name: gitconfig\n          readOnly: true\n      volumes:\n      - emptyDir:\n          medium: Memory\n          sizeLimit: 500Mi\n        name: goproxy\n      - name: gitconfig\n        secret:\n          secretName: gitconfig\n---\napiVersion: v1\ndata:\n  # NOTE: Encoded version of the following, replacing ${GITHUB_PERSONAL_ACCESS_TOKEN}\n  # [url \"https://${GITHUB_PERSONAL_ACCESS_TOKEN}@github.com/\"]\n  # insteadOf = https://github.com/\n  .gitconfig: *****************************\nkind: Secret\nmetadata:\n  name: test\n```\n\n## Appendix\n\n- If running locally, set `export GOPROXY=http://localhost[:PORT]` to use your goproxy.\n- Set `export GOPROXY=direct` to directly access modules without your goproxy.\n","funding_links":["https://github.com/sponsors/oiooj"],"categories":["Popular","Misc","Go","开源类库","Open source library","Containers \u0026 Language Extentions \u0026 Linting","Repositories"],"sub_categories":["依赖管理","Dependency Management","For Go"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoproxyio%2Fgoproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoproxyio%2Fgoproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoproxyio%2Fgoproxy/lists"}