mirror of https://github.com/goproxyio/goproxy
fix golint
parent
94fcf94f0a
commit
ead1140c92
|
@ -1,5 +1,8 @@
|
||||||
|
# GOPROXY
|
||||||
|
|
||||||
# GOPROXY [](https://circleci.com/gh/goproxyio/goproxy)
|
[](https://circleci.com/gh/goproxyio/goproxy)
|
||||||
|
[](https://goreportcard.com/report/github.com/goproxyio/goproxy)
|
||||||
|
[](https://godoc.org/github.com/goproxyio/goproxy)
|
||||||
|
|
||||||
A global proxy for go modules. see: [https://goproxy.io](https://goproxy.io)
|
A global proxy for go modules. see: [https://goproxy.io](https://goproxy.io)
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,10 @@ import (
|
||||||
"github.com/goproxyio/goproxy/v2/sumdb"
|
"github.com/goproxyio/goproxy/v2/sumdb"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ListExpire list data expire data duration.
|
||||||
const ListExpire = 5 * time.Minute
|
const ListExpire = 5 * time.Minute
|
||||||
|
|
||||||
// A RouterOps provides the proxy host and the external pattern
|
// RouterOptions provides the proxy host and the external pattern
|
||||||
type RouterOptions struct {
|
type RouterOptions struct {
|
||||||
Pattern string
|
Pattern string
|
||||||
Proxy string
|
Proxy string
|
||||||
|
@ -103,6 +104,7 @@ func NewRouter(srv *Server, opts *RouterOptions) *Router {
|
||||||
return rt
|
return rt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Direct decides whether a path should directly access.
|
||||||
func (rt *Router) Direct(path string) bool {
|
func (rt *Router) Direct(path string) bool {
|
||||||
if rt.pattern == "" {
|
if rt.pattern == "" {
|
||||||
return false
|
return false
|
||||||
|
@ -153,9 +155,8 @@ func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
log.Printf("------ --- %s [proxy]\n", r.URL)
|
log.Printf("------ --- %s [proxy]\n", r.URL)
|
||||||
rt.proxy.ServeHTTP(w, r)
|
rt.proxy.ServeHTTP(w, r)
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
ctype = "text/plain; charset=UTF-8"
|
|
||||||
}
|
}
|
||||||
|
ctype = "text/plain; charset=UTF-8"
|
||||||
} else {
|
} else {
|
||||||
ext := path.Ext(what)
|
ext := path.Ext(what)
|
||||||
switch ext {
|
switch ext {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright 2019 The Go Authors. All rights reserved.
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package proxy implements the HTTP protocols for serving a Go module proxy.
|
// Package proxy implements the HTTP protocols for serving a Go module proxy.
|
||||||
package proxy
|
package proxy
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
// Copyright 2019 The Go Authors. All rights reserved.
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
// Package proxy implements the HTTP protocols for serving a Go module proxy.
|
|
||||||
|
// Package sumdb implements sumdb handler proxy.
|
||||||
package sumdb
|
package sumdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
Loading…
Reference in New Issue