diff --git a/README.md b/README.md index a1b2e2b..c422070 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ +# GOPROXY -# GOPROXY [![CircleCI](https://circleci.com/gh/goproxyio/goproxy.svg?style=svg)](https://circleci.com/gh/goproxyio/goproxy) +[![CircleCI](https://circleci.com/gh/goproxyio/goproxy.svg?style=svg)](https://circleci.com/gh/goproxyio/goproxy) +[![Go Report Card](https://goreportcard.com/badge/github.com/goproxyio/goproxy)](https://goreportcard.com/report/github.com/goproxyio/goproxy) +[![GoDoc](https://godoc.org/github.com/goproxyio/goproxy?status.svg)](https://godoc.org/github.com/goproxyio/goproxy) A global proxy for go modules. see: [https://goproxy.io](https://goproxy.io) diff --git a/proxy/router.go b/proxy/router.go index c5d0caa..fe24361 100644 --- a/proxy/router.go +++ b/proxy/router.go @@ -19,9 +19,10 @@ import ( "github.com/goproxyio/goproxy/v2/sumdb" ) +// ListExpire list data expire data duration. 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 { Pattern string Proxy string @@ -103,6 +104,7 @@ func NewRouter(srv *Server, opts *RouterOptions) *Router { return rt } +// Direct decides whether a path should directly access. func (rt *Router) Direct(path string) bool { if rt.pattern == "" { return false @@ -153,9 +155,8 @@ func (rt *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) { log.Printf("------ --- %s [proxy]\n", r.URL) rt.proxy.ServeHTTP(w, r) return - } else { - ctype = "text/plain; charset=UTF-8" } + ctype = "text/plain; charset=UTF-8" } else { ext := path.Ext(what) switch ext { diff --git a/proxy/server.go b/proxy/server.go index 8c7c3e2..c3bbbd3 100644 --- a/proxy/server.go +++ b/proxy/server.go @@ -1,6 +1,7 @@ // Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. + // Package proxy implements the HTTP protocols for serving a Go module proxy. package proxy diff --git a/sumdb/handler.go b/sumdb/handler.go index 9695b00..0378466 100644 --- a/sumdb/handler.go +++ b/sumdb/handler.go @@ -1,7 +1,8 @@ // Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // 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 import (