-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75a399b
commit 9a0e39b
Showing
3 changed files
with
63 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
module dohoarding | ||
|
||
go 1.15 | ||
go 1.16 | ||
|
||
require ( | ||
github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd // indirect | ||
github.com/gin-gonic/gin v1.6.3 | ||
github.com/go-sql-driver/mysql v1.5.0 | ||
github.com/elazarl/goproxy v0.0.0-20210110162100-a92cc753f88e // indirect | ||
github.com/gin-gonic/gin v1.7.2 | ||
github.com/go-sql-driver/mysql v1.6.0 | ||
github.com/joho/godotenv v1.3.0 | ||
github.com/kr/pretty v0.2.0 // indirect | ||
github.com/lib/pq v1.1.1 // indirect | ||
github.com/mattn/go-isatty v0.0.13 // indirect | ||
github.com/mattn/go-sqlite3 v1.14.0 // indirect | ||
github.com/mitchellh/go-homedir v1.1.0 | ||
golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd // indirect | ||
github.com/stretchr/testify v1.6.1 // indirect | ||
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect | ||
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect | ||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect | ||
gopkg.in/testfixtures.v2 v2.6.0 | ||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,32 @@ | ||
package routers | ||
|
||
import ( | ||
"dohoarding/handlers/proxy" | ||
dproxy "dohoarding/handlers/proxy" | ||
"github.com/elazarl/goproxy" | ||
"github.com/gin-gonic/gin" | ||
"log" | ||
"net/http" | ||
) | ||
|
||
func ProxyRouter(r *gin.Engine) { | ||
|
||
proxy := goproxy.NewProxyHttpServer() | ||
proxy.Verbose = true | ||
log.Fatal(http.ListenAndServe(":8080", proxy)) | ||
|
||
//mavenGroup := r.Group("/repo") | ||
//mavenGroup.GET("maven*", handlers.Proxy) | ||
//r.GET("/repo/maven/:path", handlers.Proxy) | ||
r.GET("/proxy/apt/*path", proxy.Apt) | ||
r.GET("/proxy/maven/*path", proxy.Maven) | ||
r.GET("/proxy/apt/*path", proxy.Apt) | ||
//r.GET("/proxy/vagrant/*path", proxy.Vagrant) | ||
r.GET("/proxy/apt/*path", dproxy.Apt) | ||
r.GET("/proxy/maven/*path", dproxy.Maven) | ||
//r.GET("/proxy/vagrant/*path", func(context *gin.Context) { | ||
// proxy.OnRequest().DoFunc( | ||
// func(r *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) { | ||
// if h, _, _ := time.Now().Clock(); h <= 8 && h <= 17 { | ||
// return r, goproxy.NewResponse(r, goproxy.ContentTypeText, http.StatusForbidden, "Don't waste your time!") | ||
// } | ||
// return r, nil | ||
// }, | ||
// ) | ||
//}) | ||
} |