1
0
Fork 0
mirror of https://github.com/Luzifer/expose.git synced 2024-11-08 14:20:04 +00:00

Support gzip compression on server

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-09-17 21:23:57 +02:00
parent 647f50effc
commit 48b6fcf4c5
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -8,6 +8,8 @@ import (
"os/signal" "os/signal"
"github.com/Luzifer/expose/ngrok2" "github.com/Luzifer/expose/ngrok2"
http_helper "github.com/Luzifer/go_helpers/http"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -43,7 +45,7 @@ var serveCmd = &cobra.Command{
return fmt.Errorf("Unable to create tunnel: %s", err) return fmt.Errorf("Unable to create tunnel: %s", err)
} }
go http.Serve(listener, http.FileServer(http.Dir("."))) go http.Serve(listener, http_helper.GzipHandler(http.FileServer(http.Dir("."))))
fmt.Printf("Created HTTP server for this directory with URL %s\nPress Ctrl+C to stop server and tunnel", tun.PublicURL) fmt.Printf("Created HTTP server for this directory with URL %s\nPress Ctrl+C to stop server and tunnel", tun.PublicURL)
c := make(chan os.Signal, 1) c := make(chan os.Signal, 1)