frps dashboard add stcp

This commit is contained in:
fatedier
2018-05-20 19:06:05 +08:00
parent e1918f6396
commit 6eb8146334
43 changed files with 5115 additions and 3248 deletions

View File

@ -18,9 +18,9 @@ import (
"io"
"net/http"
"github.com/julienschmidt/httprouter"
frpNet "github.com/fatedier/frp/utils/net"
"github.com/gorilla/mux"
)
const PluginStaticFile = "static_file"
@ -61,9 +61,10 @@ func NewStaticFilePlugin(params map[string]string) (Plugin, error) {
} else {
prefix = "/"
}
router := httprouter.New()
router.Handler("GET", prefix+"*filepath", frpNet.MakeHttpGzipHandler(
frpNet.NewHttpBasicAuthWraper(http.StripPrefix(prefix, http.FileServer(http.Dir(localPath))), httpUser, httpPasswd)))
router := mux.NewRouter()
router.Use(frpNet.NewHttpAuthMiddleware(httpUser, httpPasswd).Middleware)
router.PathPrefix(prefix).Handler(frpNet.MakeHttpGzipHandler(http.StripPrefix(prefix, http.FileServer(http.Dir(localPath))))).Methods("GET")
sp.s = &http.Server{
Handler: router,
}