diff options
| author | Feuerfuchs <git@feuerfuchs.dev> | 2019-11-12 10:54:47 +0100 |
|---|---|---|
| committer | Feuerfuchs <git@feuerfuchs.dev> | 2019-11-12 10:54:47 +0100 |
| commit | fadf666704b098b37f9c6a0b6aed8a43c9ab213d (patch) | |
| tree | 79d35bc4e748d11d01d13678fcecc8190dcbc182 /gopherproxy.go | |
| parent | Add setting to use proportional font (diff) | |
| download | gopherproxy-fadf666704b098b37f9c6a0b6aed8a43c9ab213d.tar.gz gopherproxy-fadf666704b098b37f9c6a0b6aed8a43c9ab213d.tar.bz2 gopherproxy-fadf666704b098b37f9c6a0b6aed8a43c9ab213d.zip | |
Enable compression with brotli
Diffstat (limited to 'gopherproxy.go')
| -rw-r--r-- | gopherproxy.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gopherproxy.go b/gopherproxy.go index 34e6ff8..c91afdf 100644 --- a/gopherproxy.go +++ b/gopherproxy.go | |||
| @@ -21,6 +21,8 @@ import ( | |||
| 21 | "github.com/gobuffalo/packr/v2" | 21 | "github.com/gobuffalo/packr/v2" |
| 22 | 22 | ||
| 23 | "github.com/davidbyttow/govips/pkg/vips" | 23 | "github.com/davidbyttow/govips/pkg/vips" |
| 24 | |||
| 25 | "github.com/NYTimes/gziphandler" | ||
| 24 | ) | 26 | ) |
| 25 | 27 | ||
| 26 | type Item struct { | 28 | type Item struct { |
| @@ -382,11 +384,11 @@ func ListenAndServe(bind, robotsfile string, robotsdebug bool, vipsconcurrency i | |||
| 382 | ConcurrencyLevel: vipsconcurrency, | 384 | ConcurrencyLevel: vipsconcurrency, |
| 383 | }) | 385 | }) |
| 384 | 386 | ||
| 385 | http.HandleFunc("/", GopherHandler(tpl, robotsdata, AssetList{styleAsset, jsAsset, fontwAsset, fontw2Asset, propfontwAsset, propfontw2Asset}, robotsdebug, uri)) | 387 | http.Handle("/", gziphandler.GzipHandler(GopherHandler(tpl, robotsdata, AssetList{styleAsset, jsAsset, fontwAsset, fontw2Asset, propfontwAsset, propfontw2Asset}, robotsdebug, uri))) |
| 386 | http.HandleFunc("/robots.txt", RobotsTxtHandler(robotstxtdata)) | 388 | http.Handle("/robots.txt", gziphandler.GzipHandler(RobotsTxtHandler(robotstxtdata))) |
| 387 | http.HandleFunc("/favicon.ico", FaviconHandler(favicondata)) | 389 | http.Handle("/favicon.ico", gziphandler.GzipHandler(FaviconHandler(favicondata))) |
| 388 | http.HandleFunc(styleAsset, StyleHandler(styledata)) | 390 | http.Handle(styleAsset, gziphandler.GzipHandler(StyleHandler(styledata))) |
| 389 | http.HandleFunc(jsAsset, JavaScriptHandler(jsdata)) | 391 | http.Handle(jsAsset, gziphandler.GzipHandler(JavaScriptHandler(jsdata))) |
| 390 | http.HandleFunc(fontwAsset, FontHandler(false, fontdataw)) | 392 | http.HandleFunc(fontwAsset, FontHandler(false, fontdataw)) |
| 391 | http.HandleFunc(fontw2Asset, FontHandler(true, fontdataw2)) | 393 | http.HandleFunc(fontw2Asset, FontHandler(true, fontdataw2)) |
| 392 | http.HandleFunc(propfontwAsset, FontHandler(false, propfontdataw)) | 394 | http.HandleFunc(propfontwAsset, FontHandler(false, propfontdataw)) |
