Giter Site home page Giter Site logo

linuxerwang / goproxy-3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from goproxyio/goproxy

0.0 2.0 0.0 99 KB

A global proxy for Go modules.

Home Page: https://goproxy.io

License: MIT License

Go 95.48% HTML 2.27% Shell 0.55% Dockerfile 1.02% Makefile 0.68%

goproxy-3's Introduction

GOPROXY CircleCI

A global proxy for go modules. see: https://goproxy.io

Requirements

It invokes the local go command to answer requests.
The default cacheDir is GOPATH, you can set it up by yourself according to the situation.

Build

git clone https://github.com/goproxyio/goproxy.git
cd goproxy
make

Started

Proxy mode

./bin/goproxy -listen=0.0.0.0:80 -cacheDir=/tmp/test

If you run `go get -v pkg` in the proxy machine, should set a new GOPATH which is different from the old GOPATH, or mayebe deadlock.
See the file test/get_test.sh.

Router mode

Use the -proxy flag switch to "Router mode", which implements route filter to routing private module or public module .

                                         direct
                      +----------------------------------> private repo
                      |
                 match|pattern
                      |
                  +---+---+           +----------+
go get  +-------> |goproxy| +-------> |goproxy.io| +---> golang.org/x/net
                  +-------+           +----------+
                 router mode           proxy mode

In Router mode, use the -exclude flag set pattern , direct to the repo which match the module path, pattern are matched to the full path specified, not only to the host component.

./bin/goproxy -listen=0.0.0.0:80 -cacheDir=/tmp/test -proxy https://goproxy.io -exclude "*.corp.example.com,rsc.io/private"

Use docker image

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 cacheDir:/go goproxy/goproxy

Docker Compose

docker-compose up

Appendix

  1. set export GOPROXY=http://localhost to enable your goproxy.
  2. set export GOPROXY=direct to disable it.

goproxy-3's People

Contributors

oiooj avatar hxzhao527 avatar ianwoolf avatar fsm-xyz avatar prologic avatar rainbowmango avatar fancy-rabbit avatar jsign avatar nafisfaysal avatar mr-tron avatar schemacs avatar mmelnyk avatar superryanguo avatar senmumu avatar bastjan avatar edwardpro avatar imneov avatar codeskyblue avatar rmfish avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.