godoc: use Google’s CDN edge cache to serve downloads

This increases reliability and performance of downloads
across locales.

Change-Id: I619f986496dea57e1ee5e8150e31b2a6f8d8dde7
Reviewed-on: https://go-review.googlesource.com/60090
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This commit is contained in:
Andrew Bonventre 2017-08-29 17:31:23 -04:00
parent 3b1faeda9a
commit aebcdfcd02

View File

@ -35,9 +35,9 @@ import (
) )
const ( const (
gcsBaseURL = "https://storage.googleapis.com/golang/" edgeCacheBaseURL = "https://redirector.gvt1.com/edgedl/go/"
cacheKey = "download_list_3" // increment if listTemplateData changes cacheKey = "download_list_3" // increment if listTemplateData changes
cacheDuration = time.Hour cacheDuration = time.Hour
) )
func RegisterHandlers(mux *http.ServeMux) { func RegisterHandlers(mux *http.ServeMux) {
@ -133,7 +133,7 @@ func (f File) Highlight() bool {
} }
func (f File) URL() string { func (f File) URL() string {
return gcsBaseURL + f.Filename return edgeCacheBaseURL + f.Filename
} }
type Release struct { type Release struct {