[client] Remove redundant function parameters (#3016)

This commit is contained in:
chenjiayao 2022-07-14 15:31:32 +08:00 committed by GitHub
parent 6f2571980c
commit 1bc899ec12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 11 deletions

View File

@ -6,18 +6,11 @@ import (
"github.com/fatedier/frp/pkg/msg" "github.com/fatedier/frp/pkg/msg"
) )
type Type int
const (
EvStartProxy Type = iota
EvCloseProxy
)
var ( var (
ErrPayloadType = errors.New("error payload type") ErrPayloadType = errors.New("error payload type")
) )
type Handler func(evType Type, payload interface{}) error type Handler func(payload interface{}) error
type StartProxyPayload struct { type StartProxyPayload struct {
NewProxyMsg *msg.NewProxy NewProxyMsg *msg.NewProxy

View File

@ -75,7 +75,7 @@ func (pm *Manager) HandleWorkConn(name string, workConn net.Conn, m *msg.StartWo
} }
} }
func (pm *Manager) HandleEvent(evType event.Type, payload interface{}) error { func (pm *Manager) HandleEvent(payload interface{}) error {
var m msg.Message var m msg.Message
switch e := payload.(type) { switch e := payload.(type) {
case *event.StartProxyPayload: case *event.StartProxyPayload:

View File

@ -145,7 +145,7 @@ func (pw *Wrapper) Stop() {
} }
func (pw *Wrapper) close() { func (pw *Wrapper) close() {
pw.handler(event.EvCloseProxy, &event.CloseProxyPayload{ pw.handler(&event.CloseProxyPayload{
CloseProxyMsg: &msg.CloseProxy{ CloseProxyMsg: &msg.CloseProxy{
ProxyName: pw.Name, ProxyName: pw.Name,
}, },
@ -174,7 +174,7 @@ func (pw *Wrapper) checkWorker() {
var newProxyMsg msg.NewProxy var newProxyMsg msg.NewProxy
pw.Cfg.MarshalToMsg(&newProxyMsg) pw.Cfg.MarshalToMsg(&newProxyMsg)
pw.lastSendStartMsg = now pw.lastSendStartMsg = now
pw.handler(event.EvStartProxy, &event.StartProxyPayload{ pw.handler(&event.StartProxyPayload{
NewProxyMsg: &newProxyMsg, NewProxyMsg: &newProxyMsg,
}) })
} }