mirror of
https://github.com/fatedier/frp.git
synced 2026-03-17 23:39:16 +08:00
lint by golangci-lint (#3080)
This commit is contained in:
@@ -11,14 +11,14 @@ import (
|
||||
"github.com/fatedier/frp/test/e2e/mock/server/httpserver"
|
||||
)
|
||||
|
||||
type PluginHandler func(req *plugin.Request) *plugin.Response
|
||||
type Handler func(req *plugin.Request) *plugin.Response
|
||||
|
||||
type NewPluginRequest func() *plugin.Request
|
||||
|
||||
func NewHTTPPluginServer(port int, newFunc NewPluginRequest, handler PluginHandler, tlsConfig *tls.Config) *httpserver.Server {
|
||||
func NewHTTPPluginServer(port int, newFunc NewPluginRequest, handler Handler, tlsConfig *tls.Config) *httpserver.Server {
|
||||
return httpserver.New(
|
||||
httpserver.WithBindPort(port),
|
||||
httpserver.WithTlsConfig(tlsConfig),
|
||||
httpserver.WithTLSConfig(tlsConfig),
|
||||
httpserver.WithHandler(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||
r := newFunc()
|
||||
buf, err := io.ReadAll(req.Body)
|
||||
@@ -35,7 +35,7 @@ func NewHTTPPluginServer(port int, newFunc NewPluginRequest, handler PluginHandl
|
||||
resp := handler(r)
|
||||
buf, _ = json.Marshal(resp)
|
||||
log.Trace("plugin response: %s", string(buf))
|
||||
w.Write(buf)
|
||||
_, _ = w.Write(buf)
|
||||
})),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user